9 ExampleCode
Emil Gedda edited this page 2018-07-24 11:20:43 +02:00

Example Code

The Mapnik source comes with some example code in the mapnik/demo directory.

Here are some other sets of Example Code to learn from.


C++ Code

California

  • Name: cali.cpp
  • Description: A sample program, adapted from demo/c++/rundemo.cpp which demonstrates how one might use the Mapnik C++ API to render the state of California from USGS Shapefile data.
  • Source: https://gist.github.com/lwu/5009
  • Tested On: Mac OS 10.5
  • Added by: lwu

Servers

C++ profiling tests

FreeMap


Python Code

Hello World

World Population

Cairo Renderer

Code samples for writing to SVG and PDF

mapnik-utils

The mapnik-utils project includes some example code as well: http://code.google.com/p/mapnik-utils/

ShieldSymbolizer

An e-mail on Mapnik ShieldSymbolizer. Also describes use of

    $ python 
     >>>import mapnik 
     >>>dir(mapnik) 
     >>>help(mapnik) 

and

    $ pydoc -p 8080 

and then open a browser and go to : http://localhost:8080/mapnik.html