Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Example of using the Mapnik python API to save a map constructed in python into an XML string or file
>>> import mapnik
>>> m = mapnik.Map(256,256)
>>> m.background = mapnik.Color('green')
>>> print mapnik.save_map_to_string(m)
<?xml version="1.0" encoding="utf-8"?>
<Map srs="+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs" background-color="rgb(0,128,0)"/>
>>> mapnik.save_map(m,'file.xml')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.