geopy

Stumbled upon geopy while looking through a fantastic list of OSS and Linux GIS tools.

Geopy lets me code a geocoder in 6 lines of python using the google maps API.


Example:

#!/usr/bin/python
from geopy import geocoders
import sys
g = geocoders.Google('ENTER YOUR API KEY HERE')
address = sys.argv[1]
place, (lat,lng) = g.geocode(address)
print "%s: %.5f, %.5f" % (place,lat,lng)

Then run from the command line like so:

# geoloc "500 Main St. 42367"
500 Main St, Powderly, KY 42367, USA: 37.23329, -87.16244

Nice!

0 Responses to “geopy”


  1. No Comments

Leave a Reply