Mapnik configuration XML
General
Comments can be placed in the configuration file using the default xml <!-- --> syntax
Map
The Map object defines the master object of a mapnik configuration XML. It defines map wide parameters and serves as the envelope for Style and Layer definitions.
- Element: Map
- Element type: Root element
- Attributes:
- bgcolor: HTML color code for the background-color of the map (for instance #000000)
- srs: Coordinate system in which the map is rendered (for instance "+proj=latlong+datum=WGS84" for a WGS84 Geographic coordinate system)
- buffer_size: ??
- Children:
- Style: See Style
- Layer: See Layer
- FileSource?: ?? -> Attribute name = someName. What does it do?
- Datasource: See Datasource
- FontSet?: ?? -> Seems to be used to match fonts to fonts on the server?
- xmlcomment: (Ignored by Mapnik)
- xmlattr: (Ignored by Mapnik)
Style
A Style object defines the way objects can be rendered. A Mapnik configuration file can have an unlimited number of Style objects. Style objects are referenced by Layer objects in order to actualy be rendered.
- Element: Style
- Element type: Collection of Rules
- Attributes
- name: Name for this Style object. Needs to be unique per configuration file. A Style is referenced by a Layer through the corresponding StyleName? parameter. If a name is ommited, what will happen?
- Children:
- Rule: See Rule
- xmlcomment: (Ignored by Mapnik)
- xmlattr: (Ignored by Mapnik)
Layer
- Element: Layer
- Element type: References a Style (StyleName?) and a DataSource?
- Attributes:
- name: The Name of the layer
- status: on or off
- clear_label_cache
- srs: Reference system from the the project [Proj.4]. e.g. +proj=latlong +datum=WGS84
- Children:
- StyleName?: The name of a defined style. The style must contain the same string in the attribute name.
- Datasource: See Datasource
Datasource
- Element: Datasource
- Element type:
- Attributes: none
- Generic Parameters:
- type: Specifies the format of the data source
- Possible values:
- shape : ESRI shapefile
- postgis : Postgis table or query
- gdal : GDAL supported raster datasource
- raster : Tiled or stripped TIFF
- osm : Open Street Map (not included by default)
- Possible values:
- estimate_extent: boolean to tell Mapnik to estimate the extent of the layer (true) or not (false)
- extent: manually enter an extent if estimate_extent is set to false
- type: Specifies the format of the data source
- Additional parameters for type postgis
- host: The name of the postgis-server
- port: The port of the postgis-server
- dbname: database name
- user: username to access the postgis database
- password: The password of the username to access the postgis database
- table: Name of the table or postgis query. subquery has to use sytax of: '( ) as table'
- geometry_field: Use the geometry_field parameter to specify which field to use if you have >1 geometry in the table/query (added in r769).
- Additional parameters for type shape
- file: For shape type; location and name (without extension) of the ESRI shapefile
- Additional parameters for type osm
- file: location and name (with extension) of the OSM Filename
- parser: Parser for the xml file. (Should be 'libxml2')
Rule
- Element: Rule
- Element type:
- Attributes
- name
- title
- Children:
Also see SymbologySupport for more info on Symbolizers
