I would like to create Mapnik style using Python API and export it to XML-file. Creating style part is clear enough API has sufficient documentation. But I wasn't able to find function that does the import of created style to XML. Does it exist?


You can use mapnik.save_map()

import mapnik
m = mapnik.Map(1440,800)
# ... add styling and layers ...
mapnik.save_map(m, "output.xml")
  • By the way, I found the Mapnik Python documentation to be lacking a lot as well. I found a search engine for Python code called Nullege, it helps a lot in discovering Mapnik features and how to use them. – chrki Feb 2 '16 at 18:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.