Skip to content Skip to sidebar Skip to footer

How To Geocode Addresses On The Server

I am writing an app with Google App Engine using python and I am turning a large wikipedia list into a spreadsheet and then inputting the list rows into Locations. For example thi

Solution 1:

There is the geopy library.

Example (from the getting started page):

from geopy import geocoders

g = geocoders.Google()
place, (lat, lng) = g.geocode("10900 Euclid Ave in Cleveland")
print"%s: %.5f, %.5f" % (place, lat, lng)
    10900 Euclid Ave, Cleveland, OH 44106, USA: 41.50489, -81.61027  

Solution 2:

Google geocode does not require any key to use.

All information about the most recent version can be found:

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

all you have to do is make a request to:

(example) http://maps.googleapis.com/maps/api/geocode/json?latlng=40.714224,-73.961452&sensor=false

then use urllib

import urllib
// pull lat and lng from your parks database and construct a url like:
url = 'http://maps.googleapis.com/maps/api/geocode/json?latlng=40.714224,-73.961452&sensor=false'

resp = urllib.urlopen(url)
resp.read() // json string convert to python dict

It is rate limited, But it is a free service. It is most certainly not all done with javascript. Why does it matter if it is rate limited if you are just geocoding a static list of nc parks?

Post a Comment for "How To Geocode Addresses On The Server"