»
Nov 4th, 2009,
category:
Python
,
Perm Link...
Reverse GeoCoding
Google map has APIs to do reverse geocoding which is a process to get latitude and longitude by location address.
There is alternative service to get reverse geocoding call GeoNames. I will show you how to use both of them using geopy A Geocoding Toolbox for Python
Install geopy
svn checkout http://geopy.googlecode.com/svn/branches/reverse-geocode geopy
cd geopy/
sudo python setup.py install
Using Google API
from geopy import geocoders g = geocoders.Google(GOOGLE_KEY) (place, point) = g.geocode("562 Kendall Ave, Palo Alto, CA") (new_place,new_point) = g.reverse(point)
Using GeoNames
from geopy import geocoders g = geocoders.GeoNames() (place, point) = g.geocode("Palo Alto, CA 94306") (new_place,new_point) = g.reverse(point)
Comments
# Patrick Nov 18th, 2009
Thank you for the code, but could you help me to get one (and only one) result ?