© GeoPy Project and individual contributors, MIT License
geopy is a Python client for several popular geocoding web services.
geopy makes it easy for Python developers to locate the coordinates of addresses, cities, countries, and landmarks across the globe using third-party geocoders and other data sources.
geopy includes geocoder classes for the Google Geocoding API (V3), the Yahoo! geocoder, geocoder.us, Bing Maps API, and several more Geocoder API services. The various geocoder classes are located in geopy.geocoders.
- Having
geopy.geocoders.google.GBadKeyError
issues with Google geocoder? You can fix that by updating GeoPy and updating your code.
Using pip:
pip install geopy
Or, manually: Download the tarball from PyPI, unzip, and execute this in the same directory:
python setup.py install
Examples
Using the GoogleV3 geocoder:
>>> from geopy import geocoders
>>> g = geocoders.GoogleV3()
>>> place, (lat, lng) = g.geocode("10900 Euclid Ave in Cleveland")
>>> print "%s: %.5f, %.5f" % (place, lat, lng)
10900 Euclid Ave, Cleveland, OH 44106, USA: 41.50489, -81.61027
Using the Yahoo! geocoder (requires an Application ID):
>>> from geopy import geocoders
>>> y = geocoders.Yahoo('YOUR_APP_ID_HERE')
>>> place, (lat, lng) = y.geocode("Thames Street, Newport, RI")
>>> print "%s: %.5f, %.5f" % (place, lat, lng)
[241-251] THAMES ST, NEWPORT, RI 02840, US: 41.48696, -71.31490
More documentation and examples can be found on the old Google Code documentation site.