GeoNames Home | Postal Codes | Download / Webservice | About 

GeoNames Forum
  [Search] Search   [Recent Topics] Recent Topics   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
geonames reverse geocoding - find the closest city  XML
Forum Index -> General
Author Message
xsnowy



Joined: 07/02/2012 17:41:21
Messages: 2
Offline

Hi guys,

is there a way to retrieve the closest city near given latitude / longitude? I use it on my own, but the web service behaves the same.

Example: Some place in New York City. I get the following results with reverse geocoding (place+distance in km):

["Little Italy, 0.13681296377487645","Downtown Manhattan, 0.1902665853428969","SoHo, 0.3944851681490419","Lower East Side, 0.910033936135459","New York City, 1.00695437055065","Greenwich Village, 1.1061205320538845","Hillman Housing, 1.4246156975098168","East River Houses, 1.625263408842266","Vinegar Hill, 2.106118549478905","Grammercy Park, 2.1562686221616816"]

However, I'd need only New York City to be returned (the others aren't cities). Unfortunately, I cannot use admin2codes with "Little Italy" for example - it returns New York County, not New York City.

Any ideas how to get the closest city and only city near given lat/lng?

Thanks!
xsnowy
marc



Joined: 08/12/2005 07:39:47
Messages: 4501
Offline

The service returns a low granularity. For mega cities it will indeed return smaller neighbourhoods. You will have to filter by population if you are only interested in the largest city or you could use the postal code services as they have a lower granularity with fewer places.

Best

Marc

[WWW]
 
Forum Index -> General
Go to:   
Powered by JForum 2.1.5 © JForum Team