Skip to content

Instantly share code, notes, and snippets.

@vgmoose
Created December 11, 2015 18:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vgmoose/bd0d690b95a15f275f57 to your computer and use it in GitHub Desktop.
Save vgmoose/bd0d690b95a15f275f57 to your computer and use it in GitHub Desktop.
import urllib2, urllib
import json
# needs the "Google Maps Geocoding API" enabled for your API key
apikey = "YOUR_API_KEY_HERE"
address = "165 Dascomb Road, Andover, MA".replace(" ", "+")
response = urllib2.urlopen("https://maps.googleapis.com/maps/api/geocode/json?address="+address+"&key="+apikey)
data = json.load(response)["results"][0]["geometry"]["location"]
print data["lat"], data["lng"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment