How do I fetch state & country from latitude & longitude ?

Want to talk about something that isn't covered by another category?

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
i-Phonedeveloper
Posts: 2
Joined: Fri Apr 20, 2012 9:31 am
Contact:

How do I fetch state & country from latitude & longitude ?

Post by i-Phonedeveloper » Fri May 11, 2012 8:06 am

How can we fetch city,state and country from latitude and longitude ?

SparkOut
Posts: 2944
Joined: Sun Sep 23, 2007 4:58 pm

Re: How do I fetch state & country from latitude & longitude

Post by SparkOut » Fri May 11, 2012 8:20 am

define tLat and tLng with your coordinates, then

Code: Select all

get url ("http://maps.googleapis.com/maps/geo?ll=" & tLat & comma & tLng)
put it
parse the results returned, there's lots of information you can gain. "AdministrativeAreaName" is county level in UK, but returns the state in USA. A US county is returned in various forms under "SubAdministrativeArea" > "Locality" > "LocalityName", or just under "SubAdministrativeAreaName" etc etc in one form or another under a set of point ids returned in the results. Check through and see what you think is best to extract.

Post Reply