Skip to content

Instantly share code, notes, and snippets.

@Aniket-508
Created January 14, 2022 12:54
Show Gist options
  • Save Aniket-508/626e874971c3ab7a76e52e34f654cf32 to your computer and use it in GitHub Desktop.
Save Aniket-508/626e874971c3ab7a76e52e34f654cf32 to your computer and use it in GitHub Desktop.
Python program to find the distance between two addresses using Google Map API
import googlemaps
# Requires API key
gmaps = googlemaps.Client(key='API_key')
# Requires cities name
my_dist = gmaps.distance_matrix('Address1','Address2')['rows'][0]['elements'][0]
# Printing the result
print(my_dist.distance.text)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment