Publish OpenGeoData

Posted by Martin Seiler on Fri, Aug 14, 2015
In GI, OpenData, EN,
Tags mapbox github

The availability of data under open licenses keeps increasing. Many data sets in open data portals are actually spatial data, i.e. each item has a direct (or indirect) spatial reference (usually lat/lon coordinates). Nowadays there are tools freely available to publish this OpenGeoData on maps.

No coding required. Hosting included.

The liaison of Mapbox and GitHub make it possible.

I’d like to show you a little example.

Finding suitable data (the hardest part…)

First we have to find open data sets with a spatial reference. I tried my luck with GovData - the German Open Data Portal. They offer a filter for data formats. Look out for files that come as geojson, kml, kmz, shp.

Hints:

  • you want to try this approach with small data sets, otherwise it might kill your browser…)
  • it seems like a lot of the published files come with corrupt geojson, try other formats too, if you have problems

I found this data set about parking lots suitable for disabled people in Cologne and downloaded the kmz-file (CC-BY, “Stadt Köln”). The kmz-format is practically a compressed kml-file. So use your favorite tool to uncompress it (for me unzip STR.Behindertenparkplatz.kmz does the trick on the command line).

Getting the data on a map

  1. Go to http://geojson.io
  2. Click Open, File and select your kml-file

This should upload your data, transform it to geojson and display it on the map. Now you can edit the data if you like or add additional features. You can either click on a map item and edit the feature there, or directly edit stuff in the geojson code on the right. E.g. try to change the color of the marker.

Your map is ready? Let’s get it out there…

Publish your map

Whenever you’re satisfied with your map, click on Save and select Gist. Note that the message right of the menu changes from “unsaved” to something like “anonymous/d56dbf9d7028f00375c7”. Next: click on the Octocat logo just left of this.

Et voilà a new tab opens that renders your map nicely on GitHub https://gist.github.com/anonymous/d56dbf9d7028f00375c7.

Now, if you want to see just your map using the whole screen, you can refer to it by putting https://render.githubusercontent.com/view/geojson?url= in front of the git URL of the raw file. You get that by clicking on ´Raw´ above the map on GitHub.

So you end up with something like:

https://render.githubusercontent.com/view/geojson?url=https://gist.githubusercontent.com/anonymous/d56dbf9d7028f00375c7/raw/c3e96a71ad9e932c70d480d54efcde0b4c96b9f5/map.geojson

If you’d like to use it within a webpage, just add the following line to your html-file:

<script src="https://gist.github.com/anonymous/d56dbf9d7028f00375c7.js"></script>