Skip to content

Instantly share code, notes, and snippets.

@adoc
Created November 15, 2014 20:54
Show Gist options
  • Save adoc/f9fced7a68fa1b886e69 to your computer and use it in GitHub Desktop.
Save adoc/f9fced7a68fa1b886e69 to your computer and use it in GitHub Desktop.
mapquest_geocode.py: Geocoding example using mapquest API. (geopy)
from geopy.geocoders import MapQuest, OpenMapQuest, Nominatim
omapquest_api_key = "APIKEYHERE"
gm = MapQuest(api_key=omapquest_api_key, timeout=60)
gom = OpenMapQuest(api_key=omapquest_api_key, timeout=60)
gn = Nominatim(timeout=60)
loc = "611 West Holt Blvd., ontario, ca, 91762"
l = gom.geocode(loc) or gm.geocode(loc)
print(l.latitude)
print(l.longitude)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment