Here at Namara, our map of choice is Mapbox. Their maps are customizable, easy to use, and they love open sourcing their mapping tools. They also have deep roots in the open data movement, so naturally we have a soft spot for their products.
Let’s learn how to leverage the power Mapbox’s data set editor with open data from Namara.
Mapbox uses GeoJSON data out of the box. With Namara, it’s really easy to access awesome GeoJSON data. It’s a match made in tech-heaven.
First things first — head over to Namara and pick a data set with geospatial data. If you don’t have an account yet, you can sign up for free. It will only take a second.
Now that you’re signed in to Namara, click on the open data link in the sidebar and search for a geospatial data set. Try Toronto Neighbourhoods if you can’t think of anything at the moment.
For this example I’ll be working with the Toronto Neighbourhoods data set. Once you’ve found a geospatial data set that you’d like to work with click on the API Info tab under the title.
Clicking on the API Info tab will take you to a page that looks like this one below where you can find the data set ID, the version number, the API endpoint, and a table of all the properties in the data set. All this information is helpful if you want to use the Namara API.
To the right of the API Endpoint field you’ll see a blue circle with a paper clip inside.
Click this to copy the endpoint to your clipboard.
With the endpoint copied to your clipboard, paste the link into a new tab in your browser.
Before you press enter append this → result_format=geojsonto the end of the url.
You should now have an endpoint that looks something like this.
If you don’t do this step, the Namara API will return the features (points, polygons, lines, etc.) as WKT instead of GeoJSON. If you want to read about why Mapbox prefers GeoJSON here is a good post on the subject.
Now, with result_format=geojson appended to the end of the endpoint, the Namara API will return a valid GeoJSON file. All you have to do is right click in your browser, click ‘Save As…’ and name the file whateveryouwant.geojson