the core of geospatial visualization & processing
mapnik combines pixel-perfect image output with lightning-fast cartographic algorithms, and exposes interfaces in C++, Python, and Node.
latest news

As promised we are attempting to make releases of Mapnik much quicker! This allows others to more easily build libraries on top of Mapnik! Less then a month after our intial release of the 3.X series, we are proud to announce 3.0.1. This release mostly features bug fixes from mapnik 3.0.0 and should be more stable!

code in your language

mapnik's high-quality bindings let's you choose from Node.js, Python, and C++.

import mapnik
m = mapnik.Map(256,256)
mapnik.load_map(m, 'path/to/file.xml')
mapnik.render_to_file(m, 'the_image.png')
var mapnik = require('mapnik');
var fs = require('fs');
// register fonts and datasource plugins
var map = new mapnik.Map(256, 256);
map.load('./test/stylesheet.xml', function(err,map) {
	if (err) throw err;
	var im = new mapnik.Image(256, 256);
	map.render(im, function(err,im) {
		if (err) throw err;
		im.encode('png', function(err,buffer) {
			if (err) throw err;
			fs.writeFile('map.png',buffer, function(err) {
				if (err) throw err;
				console.log('saved map image to map.png');
#include <mapnik/map.hpp>
#include <mapnik/load_map.hpp>
#include <mapnik/agg_renderer.hpp>
#include <mapnik/image.hpp>
#include <mapnik/image_util.hpp>

main() {
	mapnik::Map m(256,256);
	mapnik::load_map(m, 'path/to/file.xml');
	mapnik::image_rgba8 im(256,256);
	mapnik::agg_renderer<mapnik::image_rgba8> ren(m, im);
	mapnik::save_to_file(im, 'the_image.png');

style with a stylesheet

Only a single XML stylesheet for your map, regardless of the code binding.
XML Configuration
 1 <Map background-color="blue" srs="+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs">
 2 	<Style name="My Style">
 3 		<Rule>
 4 			<PolygonSymbolizer fill="#f2eff9" />
 5 			<LineSymbolizer stroke="rgb(50%,50%,50%)" stroke-width="0.1" />
 6 		</Rule>
 7 	</Style>
 8 	<Layer name="world" srs="+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs">
 9 		<StyleName>My Style</StyleName>
10 		<Datasource>
11 			<Parameter name="file">ne_110m_countries.shp</Parameter>
12 		</Datasource>
13 	</Layer>
14 </Map>
above all else, beautiful maps
stacks built with mapnik
Copyright © 2015 Artem Pavlenko | Downloads | License | Media