How can I visualize zip code data of Germany?

Viewed 2169

I have a count for each German zip code (e.g. something like this) and I would like to visualize it.

For simplicity, lets say my data looks like this:

data = {'80337': 3, '76131': 36, '86462': 24}  # all others: 0

Now I would like to create a heat map.

I've seen pyGeoDb which looks as if it could fit my need, but I don't know how to use it. And it also seems not to work with Python 3.

3 Answers

I have the same problem and I got pyGeoDb working with python3, yet I have to use a workaround (Ubuntu 17.10):

  1. make sure pycairo is installed
  2. download the code from github (https://github.com/mdornseif/pyGeoDb)
  3. create a new folder
  4. copy or move all the files from the folders 'pygeodb', 'tools' and 'data' into your new folder
  5. make the following alterations:

    • in 'draw_german_borders.py', 'draw_germany_plz.py': change 'import pygeodb' to 'import pygeodb_core as pygeodb'
    • in 'plz2python.py' and 'plz2python2013.py' change 'import pygeodb.plzdata' to 'import plzdata'
    • 'plz_draw': rename to 'plz_draw.py', change 'pygeodb.voronoi' to 'voronoi', change 'import pygeodb' to 'import pygeodd as pygeodb' as well as 'pygeodb.borderdata' to 'borderdata'
  6. open a terminal

  7. change 'python ./plz_draw [...]' to 'python plz_draw.py [...]' and keep the rest of the arguments

At least for me it works fine and the maps are created without errors. The only drawback I encountered is that it takes some time and the resulting *.pdf is quite large (at least several 100 megs)

There probably is a more elegant way of doing this, yet for me this is sufficient and working.

Have fun!

Related