GeoNames Home | Postal Codes | Download / Webservice | About 

GeoNames Forum
  [Search] Search   [Recent Topics] Recent Topics   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
Reverse geocoding - near by place  XML
Forum Index -> General
Author Message
bitstream



Joined: 11/01/2007 15:45:23
Messages: 4
Location: Romania
Offline

First i want to say a BIG Thank you for your work. It's fantastic and I realize that what you provide was build in many many hours of hard work.

I have one question related to reverse geocoding - near by place.
I intend to use your data (downloaded into mysql) against some GPS records to display a polyline with a route.
I'm interested in how do you manage to get nearest location to some lat/long data. Ofcourse if you can tell.
My main programing language is PHP.
I readed in another post that you compare lat and long with country borders but in the downloaded file for my country i see nothing like this.

JohnShep



Joined: 15/01/2007 02:55:37
Messages: 1
Offline

Hope this helps you

Code:
 SELECT *, 
 	truncate((degrees(acos(sin(radians(latitude)) * sin( radians(" . $locale['latitude'] . ")) 
 	+ cos(radians(latitude)) * cos( radians(" . $locale['latitude'] . ")) 
 	* cos( radians(longitude - " . $locale['longitude'] . ") ) ) ) 
 	* 69.09),1) as distance_miles,
 
 	DEGREES(
 	     ACOS(
       		(
 	       	SIN(RADIANS(" . $locale['latitude'] . "))
        		*
        		SIN(RADIANS(latitude))
       		)
      		+
       		(
        		COS(RADIANS(" . $locale['latitude'] . "))
        		*
        		COS(RADIANS(latitude))
        		*
        		COS(RADIANS(" . $locale['longitude'] . " - longitude))
       		)
      		)
      		*
      		60	 * 1.1515 * 1.61
 	) AS distance_km 
 	
 	FROM locations 
 	ORDER BY `distance` ASC LIMIT 10
bitstream



Joined: 11/01/2007 15:45:23
Messages: 4
Location: Romania
Offline

Yes, your code really helps me. Thank you. A lot
 
Forum Index -> General
Go to:   
Powered by JForum 2.1.5 © JForum Team