Skip to content

Instantly share code, notes, and snippets.

@palewire
Created January 3, 2012 03:15
Show Gist options
  • Select an option

  • Save palewire/1553304 to your computer and use it in GitHub Desktop.

Select an option

Save palewire/1553304 to your computer and use it in GitHub Desktop.
import csv
from googlegeocoder import GoogleGeocoder
geocoder = GoogleGeocoder()
data = list(csv.DictReader(open('/home/ben/Downloads/latest.csv', 'r')))
outfile = open("out.csv", "w")
s = "%s, %s"
for row in data:
a = s % (row['Address'], row['Zip'])
search = geocoder.get(a)
print >> outfile, "|".join(map(str, [a, search[0].geometry.location.lat, search[0].geometry.location.lng]))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment