skip to navigation
skip to content

Not Logged In


Python bindings for mapnik

Latest Version: 2.2.0

Official mapnik bindings repackaged in the distutils way to facilitate deployments.


The python bindings are tied to the mapnik2 library version.

To use with:

  • mapnik2 library - 2.0.1:

    == mapnik2

    easy_install -U mapnik2==
  • mapnik2 library - 2.0.2:

    == mapnik2

    easy_install -U mapnik2==



Don’t forget that you can play with LDFLAGS/CFLAGS/LD_LIBRARY_PATH dto indicate non standart locations for the following requirements if it applies.

You will have to have the includes and libraries for

  • The new mapnik-config utility to be in your $PATH
  • Boost_python linked to your python interpreter If it is not installed in standart envionments, you ll have to handle the CFLAGS/LDFLAGS to find it, or use minitage ;)
  • cairo / cairomm (optionnal but enabled if you compiled mapnik with cairo support)
  • mapnik2
  • The current python interpreter


To specify which boostpython lib to link against, you can use, you can use the following:


Where you have on your filesystem:


Easy_install with or without virtualenv

  • Say where to find mapnik-config by settings correctly your PATH environment variable
  • When you’re reading this you have probably already run easy_install mapnik2. Find out how to install setuptools (and EasyInstall) here:
virtualenv --no-site-packages test
source test/bin/activate
easy_install mapnik2

If your boost python installation is not in a standart place, just set the [LD_LIBRARY_PATH, LDFLAGS, CFLAGS] to find it.


Some developers use buildout to ease deployments. * Say where to find mapnik-config by settings correctly your PATH environment variable * Add mapnik to the list of eggs to install, e.g.

parts = somepart

recipe = minitage.recipe.scripts
# (options like include dirs)
eggs =
  • Re-run buildout, e.g. with:

    $ ./bin/buildout

You can read the buildout installation shipped with this egg for inspiration.


Some developers use minitage to ease deployments (a layer upon buildout). Indeed, it takes care a lot of things like those boring compilation flags. As an example, to work on this egg in development mode, you can boostrap it by doing this::

easy_install -U virtualenv
virtualenv --no-site-packages --distribute ~/minitage
mkdir ~/minitage/others

Install minitage, if you haven’t yet

source ~/minitage/bin/activate
easy_install -U minitage.core

Initialize it (mandatory)

source ~/minitage/bin/activate
minimerge -s

To install the minilay for the mapnik2 egg development you can do

cd  ~/minitage/others
git clone mapnik-egg-(py26 or py27)
ln -fs ~/minitage/others/mapnik-egg*/minilays/mapnik-egg/  ~/minitage/minilays/mapnik-egg
#for python-2.6
minimerge -av mapnik-egg-py26
#for python-2.7
minimerge -av mapnik-egg-py27

Enjoy your installation

cd ~/minitage/others/mapnik-egg-py26
or cd ~/minitage/others/mapnik-egg-py27
>>> import mapnik2

For using mapnik2 inside your minitagified application:

Changelog for mapnik2 (2012-08-05)

  • documentation (2012-08-05)

  • renaming release

2.0.2 (2012-08-04)

2.0.1 (2012-05-06)

First public release of mapnik2 eggified python bindings

File Type Py Version Uploaded on Size (md5) Source 2012-08-05 4MB
  • Downloads (All Versions):
  • 32 downloads in the last day
  • 302 downloads in the last week
  • 1402 downloads in the last month