../_images/logo_mapnik.png

Mapnik Quickstart

Mapnik is an toolkit for developing mapping applications. Above all Mapnik is about making beautiful maps. It is easily extensible and suitable for both desktop and web development.

Mapnik & Python

Mapnik and its python bindings are installed and ready to be used for scripting on this machine.

Creating maps in python is easy with Mapnik. Open a terminal window and type python3 on the command line to enter a python interpreter. Then try this:

::
import mapnik, os m = mapnik.Map(600,400) style = ‘/usr/local/share/mapnik/world_population.xml’ mapnik.load_map(m,style) m.zoom_all() mapnik.render_to_file(m,’world_population.png’) os.system(‘xdg-open world_population.png’)

Nota

The above code depends on having an XML stylesheet that Mapnik can read (world_population.xml), defining the layers to read data from and the styles to apply to those layers.

Mapnik & MapProxy

A basic demo application is available which demonstrates using Mapnik with MapProxy

The demo uses the world_population.xml from the Mapnik demo.

  1. Click Geospatial ‣ Web Services ‣ MapProxy ‣ Start MapProxy. The server starts in a terminal window (which stays open and outputs basic debugging information).
  2. Open the MapProxy demo application http://0.0.0.0:8011/demo/
  3. You find the world population demo by Mapnik as a WMS layer and also the world population in combination with a the GeoServer layer topp:states (make sure GeoServer is running)
  4. You can use the MapProxy WMS in other applications for example in QGIS or in Mapbender (http://localhost/mapbender/application/mapbender_user).
  5. Observe the output in the server terminal window.

What next?