Find City, State (or province) Country for USA or international

110 views
Skip to first unread message

dsadaka

unread,
Jun 1, 2011, 12:37:49 AM6/1/11
to GeoNames
Hello there,

I've been assigned the task of finding and displaying (text only) the
City, State (province) and Country given the lat and long. (This is a
Ruby on Rails app and I'm getting the lat and long from EXIF data.)

I've been playing with the different reverse geocode lookups but don't
seem to have a consistent way to do this globally. It looks like the
extendedFindNearby is the way to go for the USA but it get's much more
complicated when non-US.

Has anyone done this? If so, can you tell me how?

TIA,
Dan

Dylan Kuhn

unread,
Jun 1, 2011, 8:46:06 AM6/1/11
to geon...@googlegroups.com
Hi Dan,

I think you can do two calls, first to countrySubdivision for the country and administrative area 1, then grab the place name from findNearbyPostalCodes for city.

-dylan-

dsadaka

unread,
Jun 2, 2011, 1:24:50 PM6/2/11
to GeoNames
Dylan,

I ended up doing one call (much faster than two) to extendedFindNearby
and parsing through to handle the three following cases:

If "address" node exists -> USA
elsif "geoname" exists -> International so I used last geoname in list
elsif "ocean" node exists -> get name of ocean

Thanks,
Dan
Reply all
Reply to author
Forward
0 new messages