Skip to content

Instantly share code, notes, and snippets.

@glw
Last active October 21, 2015 22:19
Show Gist options
  • Save glw/28f4cce2a2a295376e96 to your computer and use it in GitHub Desktop.
Save glw/28f4cce2a2a295376e96 to your computer and use it in GitHub Desktop.
python geocoder example
sudo pip install geocode
sudo apt-get install jq
sudo apt-get update
#from command line
#geocoder does not have to be google
#to save as json
geocode -p "google" addresses.txt | jq -r -c '@json' >> results3.json
#to save as csv
echo 'lat,lng,address,city,state' > results4.csv #use if you need to add column headers to csv
geocode -p "google" addresses.txt | jq [.lat,.lng,.address,.city,.state] -c | jq -r '@csv' >> results4.csv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment