Created
December 11, 2015 18:53
-
-
Save vgmoose/bd0d690b95a15f275f57 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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