Mapnik in depth
In this section, we will examine the Python interface of the Mapnik toolkit in much more detail. The Python documentation for Mapnik (http://media.mapnik.org/api_docs/python) is confusing and incomplete, so you may find this section to be a useful reference guide while writing your own Mapnik-based programs.
Note
The Mapnik toolkit is written in C++, and provides bindings to let you access it via Python. Not every feature implemented in Mapnik is available from Python; only those features that are available and relevant to the Python developer will be discussed here.
Data sources
Before you can access a given set of geospatial data within a map, you need to set up a Mapnik Datasource object. This acts as a "bridge" between Mapnik and your geospatial data:
You typically create the data source using one of the convenience constructors described here. Then you add that data source to any Mapnik Layer objects, which will use that data:
layer.datasource = datasource
A single Datasource...