Introducing Mapnik
We first looked at Mapnik in Chapter 3, Python Libraries for Geospatial Development. If you haven't already done so, please go back to the Mapnik section of that chapter and follow the instructions for installing it onto your computer.
Mapnik is a complex library with many different parts, and it is easy to get confused by the various names and concepts. Let's start our exploration of Mapnik by looking at a simple map:
One thing that may not be immediately obvious is that the various elements within the map are layered, like this:
To generate this map, you have to tell Mapnik to initially draw the background, then the polygons, and finally the labels. This ensures that the polygons sit on top of the background and the labels appear in front of both the polygons and the background.
Note
Strictly speaking, the background isn't a layer. It's simply a color or image that Mapnik draws onto the map before it starts drawing the first layer.
Mapnik allows you to control the order in...