Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion geocoders/google.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,15 @@

# https://developers.google.com/maps/documentation/geocoding/

#update:google apply no policy in using geocoding api, including 'https' instead of 'http',2500 requests/day.
#you can apply google api key in website https://console.developers.google.com after creating project, then turn on the service "Geocoding API" and create new key for browser application in "Credentials".
#you can then test your google api key in browser like this:https://maps.googleapis.com/maps/api/geocode/json?sensor=false&address=new york&key=AIzaSyCTiFJreqzvYieWdH555m--bVnO70qeJ4E

def geocode(q, api_key=None):
json = simplejson.load(urllib.urlopen(
'http://maps.googleapis.com/maps/api/geocode/json?' + urllib.urlencode({
'https://maps.googleapis.com/maps/api/geocode/json?' + urllib.urlencode({
'address': q,
'key':api_key,
'sensor': 'false',
})
))
Expand Down