© 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! BOSS Geo PlaceFinder (requires a consumer key and secret):
>>> from geopy import geocoders
>>> y = geocoders.YahooPlaceFinder('YOUR_CONSUMER_KEY', 'YOUR_CONSUMER_SECRET')
>>> place, (lat, lng) = y.geocode_one("Thames Street, Newport, RI")
>>> print "%s: %.5f, %.5f" % (place, lat, lng)
Thames St, Newport, RI 02840, United States: 41.48327, -71.31461
More documentation and examples can be found on the old Google Code documentation site.