Mapnik is an open source toolkit for rendering maps. Among other things, it is used to render the five main Slippy Map layers on the OpenStreetMap website. It supports a variety of geospatial data formats and provides flexible styling options for designing many different kinds of maps.
You can learn more about using Mapnik at #mapnik channel on freenodeand by joining the
Note that Mapnik is a software project and should not be confused with any of the common map stylesheets that might be named after Mapnik. One of them, Standard tile layer is used as the main map on the OSM website.
Mapnik allows for customization of all the cartographic aspect of a map - data features, icons, fonts, colors, patterns, and even certain effects such as pseudo-3d buildings and drop shadows. This is all controlled by defining datasources and style rules, most commonly in an XML language specific to Mapnik.
The Mapnik style rules used for the Standard OpenStreetMap are open-source and can be used as the basis for custom renderings of OSM data (see OSM Standard Mapnik Style below). Other styles are available as well, such as those used to render MapQuest Open.
There are a number of external tools that can assist in the creation of Mapnik styles. Cascadenik, Spreadnik, and TileMill offer styling languages that are more compact and easier to read and write than Mapnik's built-in XML language. QGIS also has a plugin called Quantumnik for creating Mapnik styles using a more graphical interface.
Mapnik can use data from different sources: it can directly process OSM data, PostGIS databases, shapefiles and more.
PostGIS is the most common approach for rendering OSM data with Mapnik. OSM can be loaded by a tool such as osm2pgsql or Imposm and accessed via SQL queries and GIS functions defined in a Mapnik style. This approach can be used for more advanced renderings, and is the main datasource used by the Standard OpenStreetMap layer.
Shapefiles are a common storage and exchange format for geographic data. In addition to PostGIS, the Standard OpenStreetMap style uses several shapefiles to render the map. For example, land masses are drawn using shapefiles generated from the natural=coastline ways by the Coastline Error Checker. See Coastline#Rendering.
Mapnik can render GeoTIFF files as raster images. This is commonly used for relief maps. See Hillshading with Mapnik for a step-by-step tutorial.
In a similar way to GeoTIFF, Mapnik can also render bitmap images which contain no geocoding information. The bounding box for these images has to be specified through separate parameters.
Mapnik has some limited capability for rendering directly from an OSM XML file, but this is not generally recommended. Still, it may be useful for testing Mapnik installations or for ad-hoc rendering of a map. For more information, see Mapnik: Rendering OSM XML data directly.
Detailed installation instructions for many platforms are maintained on the Mapnik Github wiki.
OSM Standard Mapnik Style
You can set up a copy of the Standard OpenStreetMap Mapnik style for your own rendering, or customize it for your own project. This style is described on this wiki on Standard tile layer. For more technical information, including setup instructions, see https://github.com/gravitystorm/openstreetmap-carto.
- Create a map from scratch: An introductory example
- Deutsche Anleitung User:Ajoessen/Mapnik
- Invoke Mapnik via Commandline nik2img
- Mapnik is used by the rendering framework TileMill.
- Renderd, Tirex as tile servers with Mapnik
- Mapnik2Geotools converts style for Geoserver
- Shaded relief maps using mapnik
- Keep the PostgreSQL database in sync with changes made on the OpenStreetMap server: Minutely Mapnik
- Nik4 is a mapnik-to-image exporting script.
- SWITCH2OSM tutorial on how to setup a tile server using mapnik on Ubuntu 14.04, also available as a Docker Image, which in turn is defined as a GitHub Repository
- Gopnik is a tile server and a render for slippy map based on mapnik library