Skip to content

Instantly share code, notes, and snippets.

@drjwbaker
Forked from pdbartsch/OpenRefine Nominatim Geocode
Last active November 26, 2015 17:45
Show Gist options
  • Save drjwbaker/2327a75623706c0fdc4a to your computer and use it in GitHub Desktop.
Save drjwbaker/2327a75623706c0fdc4a to your computer and use it in GitHub Desktop.
open-refine geocoding using OpenStreetMap's Nominatim service. (previously called google-refine)
Step One - Starting with a single address field
Edit Column > Add Column by Fetching URLs
Nominatim has a limit of 1 geocode per second so make sure to set the throttle delay to greater than 1000 milliseconds
Fetch URL based on column (quotes needed):
"http://nominatim.openstreetmap.org/search?format=json&email=[YOUR_EMAIL_HERE].com&app=google-refine&q=" + escape(value, 'url')
------------------------------------------------------------------------------------
Step Two - Extract lat/lon from newly created JSON blobs
Edit Column > Add Column based on This Column
Parse Json and concatenate latitude, longitude:
with(value.parseJson()[0], pair, pair.lat + ',' + pair.lon)
------------------------------------------------------------------------------------
Sources:
https://github.com/OpenRefine/OpenRefine/wiki/Geocoding
http://wiki.openstreetmap.org/wiki/Nominatim
https://gist.github.com/mjrich/3118660
http://www.youtube.com/watch?v=5tsyz3ibYzk&feature=player_embedded
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment