Learning Mapnik
Now that you've seen what Mapnik can do and have some idea of how Mapnik works, let's look more deeply at some of the other aspects of the Mapnik library. We will be covering datasources, symbolizers, and map rendering in this section of the chapter.
Datasources
Each map layer is associated with a
datasource (a subclass of mapnik.Datasource
) that provides the data to be displayed on the map. The various types of datasources are made available through C++ plugins, which are enabled or disabled when Mapnik is compiled. To see if a given type of datasource is available, you check to see if the associated plugin has been installed into your copy of Mapnik. You can see a list of the installed plugins (and therefore, the supported datasources) by typing the following into the Python command prompt:
import mapnik print list(mapnik.DatasourceCache.plugin_names())
The following datasource plugins are currently supported by Mapnik:
- csv: This plugin provides the
mapnik.CSV
datasource...