Skip to main content

Easy geocoding, reverse geocoding, driving directions, and local search in Python via Google.

Project description

An easy-to-use Python wrapper for the Google Maps and Local Search APIs.

Geocoding: convert a postal address to latitude and longitude

>>> from googlemaps import GoogleMaps
>>> gmaps = GoogleMaps()
>>> address = '10th St. & Constitution Ave. NW, Washington, D.C. 20560'
>>> lat, lng = gmaps.address_to_latlng(address)
>>> print lat, lng
38.892087 -77.025989

Reverse Geocoding: find the nearest address to (lat, lng)

>>> destination = gmaps.latlng_to_address(38.887563, -77.019929)
>>> print destination
200 6th St SW, Washington, DC 20024, USA

Local Search: find places matching a query near a given location

>>> local = gmaps.local_search('dinner ' + destination)
>>> print local['responseData']['results'][0]['title']
Cosmo Cafe

Directions: turn-by-turn directions, distance, time, etc. from point A to point B

>>> directions = gmaps.directions(address, destination)
>>> print directions['Directions']['Distance']['meters']
1026
>>> print directions['Directions']['Duration']['seconds']
115
>>> for step in directions['Directions']['Routes'][0]['Steps']:
...     print step['descriptionHtml']
Head <b>east</b> on <b>Constitution Ave NW</b> toward <b>9th St NW</b>
Turn <b>right</b> at <b>7th St NW</b>
Turn <b>left</b> at <b>Independence Ave SW</b>

This software is in no way associated with or endorsed by Google Inc. Use of the Google Maps API is governed by its Terms of Service: http://code.google.com/apis/maps/terms.html. Note in particular that you will need your own Google Maps API key to use this service, and that there are rate limits to the number of requests you can make.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

googlemaps-1.0.1.tar.gz (65.6 kB view details)

Uploaded Source

Built Distribution

googlemaps-1.0.1.win32.exe (71.3 kB view details)

Uploaded Source

File details

Details for the file googlemaps-1.0.1.tar.gz.

File metadata

  • Download URL: googlemaps-1.0.1.tar.gz
  • Upload date:
  • Size: 65.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for googlemaps-1.0.1.tar.gz
Algorithm Hash digest
SHA256 0be940d60a454c400d08b236e39de6f4d65dfd72add505ba32fb59e88170ed4f
MD5 457f7a99830cfa44c8e93bd017e51911
BLAKE2b-256 3f39600afafbd2367feb517977bc9411ee99f556b83c08440c58e026d684a9d8

See more details on using hashes here.

File details

Details for the file googlemaps-1.0.1.win32.exe.

File metadata

File hashes

Hashes for googlemaps-1.0.1.win32.exe
Algorithm Hash digest
SHA256 f061303dab88ee723d549f69ee5dbca297ec9fdfbd14ec3a321cb62c0dd10641
MD5 2a5f126e91e4dbe9a6b6b9c5630caf0e
BLAKE2b-256 df4000880270e7a1ea2def158b780c65e73bf873c3e6a83d7d5782482bd5bd33

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page