Mapnik

nvkelso edited this page Jun 8, 2012 · 13 revisions

Mapnik powers most of the web maps you encounter day to day. Mapnik is a free server-side rendering tool that combines data from the sources above with display rules to generate bitmap graphics of maps. It can draw lines, fill shapes, and place text. Above all Mapnik is about making beautiful maps. It is easily extensible and suitable for both desktop and web development.

Mike's Mapnik 2.0 install guide »

Conversion tips between styling language »

Mapnik 2.0 from 0.7.x Upgrade Guide »

Why upgrade to version 2.0 (over 0.7.x):

  • Carto 2.0 CSS map styling language NOTE: TileMill/Carto produces (can export) Mapnik XML compatibile with only Mapnik 2.0.0 and above.
  • Use per-feature attributes from table for CSS values instead of absolute values.
  • Resolution independent rendering (Retina) - For 144 dpi etc images using the line weights in the CSS instead of needing to change them.
  • Postgis 2.0 support
  • New MarkersSymbolizer - allowing you to draw circles of arbitrary size
  • On-the-fly Raster reprojection
  • Massively faster rendering during reprojection (e.g. from wgs84 to spherical mercator) under high load/threaded server
  • XInclude support in Stylesheets
  • More robust clipping of map extents to support more fancy projections
  • Global alignment option for polygon pattern fills
  • Added support for drawing only first matching rule using filter-mode="first" in Styles Support tix - This should likely be leveraged by Cascadenik to reducing the amount of filter combinations needed.
  • Codebase is optimized
  • Made styling syntax more consistent
  • Looks like there is a branch of Cascadenik that works with Mapnik2?
  • Metawriters for GeoJSON output of icons, labels, and feature symbolization.

Version 2.1 (coming soon):

  • Advanced, nested text styles for fallback placements
  • Much better support for labeling multigeometries Examples
  • Massively faster rendering at high zooms using better geometry clipping
  • Polygon and line bezier smoothing
  • New CSV plugin to render directly from tabular data (that includes WKT column or lon/lat columns)
  • Less memory usage with heavy data like OSM
  • Infinite zooming support (you previously could not zoom past z18-19 without problems if your data had polygons)

Performance tips

Mapnik includes a tool called shapeindex that makes loading Esri Format Shapefile geodata much more performant, almost as much as PostGIS!

Say you have a directory of shapefiles in a folder named 'shapes'. Then you can regenerate all the indexes at once like:

shapeindex shapes/*.shp