Skip to content

Instantly share code, notes, and snippets.

@CarlaAstudillo
Last active October 4, 2016 19:44
Show Gist options
  • Save CarlaAstudillo/d72f996832f7376857929b815f970432 to your computer and use it in GitHub Desktop.
Save CarlaAstudillo/d72f996832f7376857929b815f970432 to your computer and use it in GitHub Desktop.
A quick tutorial on how to geocode thousands and thousands of addresses using Mapzen in Open Refine.

Geocode in Open Refine using Mapzen

Based on this tutorial...

(because Google API and Mapquest have 2,500 and 5,000 daily requests quotas, respectively. And sometimes, we want a little more.)

  1. Click on your address column -> Edit Column -> Add column by fetching URLs

  2. Name your new column 'mapzen_geo', and in the Expression box, put:

'https://search.mapzen.com/v1/search?text='+ escape(value, 'url') + '&api_key=mapzen-XXXXXX&size=1'

(Note: Where it says api_key, put your own Mapzen API key, which you can get by making a Developer's Account in Mapzen)

You can also play around with how many coordinates it will fetch from the Mapzen API by changing 'size=', the first one that it brings up will always have the highest confidence rating)

  1. Press okay and Mapzen will bring back all of the geocoding information. Depending on how many rows you have, it could take a while.

  2. When it finishes it, create a new column named "lat" based on the your 'mapzen_geo' column and in the Expression box, put:

value.parseJson().features[0].geometry.coordinates[1]

(This is the latitude of the address)

  1. Now create a new column named "long" based on the your 'mapzen_geo' column and in the Expression box, put:
value.parseJson().features[0].geometry.coordinates[0]

(This is the longitude of the address)

  1. You can then erase the 'mapzen_geo' column, and you're done!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment