1

I want to draw a choropleth map based on german zipcode areas and some data. It should look like this, just down to zipcodes: https://maps.aimpulse.com/osm/addresses/

I asked the osm irc channel and have been told that it might even be possible with leaflet.js

So I read a bit here and there but I couldn't even find any starting point.

So any ideas are welcome.


Edit: Thanks to the answer and comment so far I think my main question is:

How do I get a list of german zipcode/postcode areas, with the corresponding coordinates for the polygons?

According to the irc channel, OpenStreetMap (OSM) has this data, and it should be possible to have it in GeoJSON format.

2
  • You should start by (a) grabbing a hold of some german postcode polygons and (b) reading the Leaflet choropleth tutorial Commented Nov 15, 2016 at 19:45
  • Thanks for the tutorial. I guess (a) is the main thing I need help about. I'll edit the question appropriately.
    – steros
    Commented Nov 15, 2016 at 19:54

3 Answers 3

1

Yep, you could/should use leaflet.js.

You simply can create a map and add osm as TileLayer. After adding OSM tilelayer you can add your zipcode information. The question is: how do you get them?

If you have the data as file (geojson) you can add a geojson layer. leaflet.js has many other options to add the zipcode information.

I am quite sure that leaflet.js can do the trick.

So you can start with:

var map = L.map('map').setView([50.106545, 8.638599], 15);

L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', {
    attribution: '&copy; <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'
}).addTo(map);

Now it depends on your zipcode-data how to implement them in leaflet.

1
  • Ah maybe there is an misunderstanding. Drawing a map with leaflet is easy. But I only have the zipcode + according data. The guys in the irc channel told me osm has the zipcode area data. But how do I connect my zipcodes (strings) with that. I found leaflet can draw polygons but it seems not to have a direct connection to osm areas to draw them?
    – steros
    Commented Nov 15, 2016 at 19:35
1

Now I get it! Getting those information is quite difficult!

You can try getting the zipcodes from the "Geoportal" - probably using the search word "Verwaltungsgrenzen". Otherwise you can have a look at the OSM Boundaries. But those informations are incomplete.

The german "post office" also hold those data, but this might be expensive!

2
  • I looked at taginfo.openstreetmap.org and it seems there are a lot of infos. The problem is to get them into the needed polygon data as all info I can find is always incomplete or just bad. I tried with osmfilter and osmconvert a bit but it seems I need another application to extract the boundary data as polygon information.
    – steros
    Commented Nov 16, 2016 at 17:05
  • But it must be possible somehow, I found this page: osm.wno-edv-service.de/pcboundaries It allows to extract this data, as GeoJson even! But you have to click all the areas and besides that would take a lot of time alone, I wouldn't want to stress that guys server. Plus I want to figure out how to do it myself.
    – steros
    Commented Nov 16, 2016 at 17:27
0

I've found this repository with that information, I don't know if it is updated but works.

Not the answer you're looking for? Browse other questions tagged or ask your own question.