From OpenStreetMap Wiki
Jump to: navigation, search
Available languages — Mapnik
Afrikaans Alemannisch aragonés asturianu azərbaycanca Bahasa Indonesia Bahasa Melayu Bân-lâm-gú Basa Jawa Baso Minangkabau bosanski brezhoneg català čeština dansk Deutsch eesti English español Esperanto estremeñu euskara français Frysk Gaeilge Gàidhlig galego Hausa hrvatski Igbo interlingua Interlingue isiXhosa isiZulu íslenska italiano Kiswahili Kreyòl ayisyen kréyòl gwadloupéyen kurdî latviešu Lëtzebuergesch lietuvių magyar Malagasy Malti Nederlands Nedersaksies norsk norsk nynorsk occitan Oromoo oʻzbekcha/ўзбекча Plattdüütsch polski português română shqip slovenčina slovenščina Soomaaliga suomi svenska Tiếng Việt Türkçe Vahcuengh vèneto Wolof Yorùbá Zazaki српски / srpski беларуская български қазақша македонски монгол русский тоҷикӣ українська Ελληνικά Հայերեն ქართული नेपाली मराठी हिन्दी অসমীয়া বাংলা ਪੰਜਾਬੀ ગુજરાતી ଓଡ଼ିଆ தமிழ் తెలుగు ಕನ್ನಡ മലയാളം සිංහල ไทย မြန်မာဘာသာ ລາວ ភាសាខ្មែរ ⵜⴰⵎⴰⵣⵉⵖⵜ አማርኛ 한국어 日本語 中文(简体)‎ 吴语 粵語 中文(繁體)‎ ייִדיש עברית اردو العربية پښتو سنڌي فارسی ދިވެހިބަސް
Screenshot of Mapnik
License: GNU Lesser General Public License
Platforms: Windows, macOS, and Linux
Version: 3.0.20 (2018-04-12)
Language: English
Programming languages: C++ and Python

Mapnik is an open source toolkit for rendering maps. Among other things, it is used to render the four 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.

Mapnik is written in C++ and can be scripted using binding languages such as JavaScript (Node.js), Python, Ruby, and Java. It uses the AGG rendering library and offers anti-aliasing rendering with subpixel accuracy. It can read ESRI shapefiles, PostGIS, TIFF rasters, .osm files, any GDAL or OGR supported formats, CSV files, and more. Pre-built packages are available for MacOS and Windows and can be found at Many Linux distributions provide packages - learn about them at Blacktocat.svg the Mapnik Installation Wiki.

You can learn more about using Mapnik at Blacktocat.svg The Mapnik Wiki and by joining the #mapnik channel on freenode

Note that Mapnik is a map rendering toolkit, and should not be confused with any of the common map stylesheets that may use Mapnik as a foundation. One of these, OpenStreetMap Carto is used as the main map on the OSM website.


Example of the Standard OpenStreetMap style, which is using Mapnik engine

Mapnik can output map images to a variety of graphics formats - PNG, JPEG, SVG, and PDF. OpenStreetMap's primary use of Mapnik involves rendering many thousands of 256 × 256 pixel tiles which are displayed in a JavaScript Slippy Map interface.

Mapnik Styles

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 data sources and style rules, most commonly in an XML language specific to Mapnik.

The Mapnik style rules used for the OSM Standard tile layer are open-source and can be used as the basis for custom renderings of OSM data. Other styles are available as well, such as Humanitarian map style.

There are a number of external tools that can assist in the creation of Mapnik styles. Cascadenik, Spreadnik, TileMill and Kosmtik 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.

Data Sources

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 Osmosis, 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 data source 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.

Raster images

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 the 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.

See also