Mapnik 3.1.0 Release Jan 08, 2021 | Artem Pavlenko
Mapnik 3.0.24 Release Jan 05, 2021 | Artem Pavlenko
Mapnik 3.0.23 Release Jan 18, 2020 | Artem Pavlenko
Mapnik 3.0.22 Release Jan 22, 2019 | Artem Pavlenko
Mapnik 3.0.21 Release Oct 08, 2018 | Artem Pavlenko
Mapnik 3.0.20 Release Apr 12, 2018 | Artem Pavlenko
Mapnik 3.0.19 Release Mar 06, 2018 | Artem Pavlenko
Mapnik 3.0.18 Release Jan 26, 2018 | Artem Pavlenko
Mapnik 3.0.16 Release Nov 16, 2017 | Artem Pavlenko
Mapnik 3.0.12 Release Sep 08, 2016 | Artem Pavlenko
Mapnik 3.0.10 Release Feb 29, 2016 | Artem Pavlenko
Node Mapnik 3.5.0 Release Feb 29, 2016 | Sam Matthews

latest news

Stylesheets and GSOC - Halfway

Jul 18, 2011

BY: Colin Rundel   Colin Rundel

As Herm and Roel have already posted, we've reached the halfway point of Google Summer of Code 2011 and all the projects are starting to come together nicely. My work with carto is also progressing and is rapidly approaching usability.

For the last couple of months of the GSOC my work has focused on two parallel and related tracks, developing both a generator (allows for translation of exisiting xml stylesheets into carto) and a parser for carto in C++. These code bases currently reside in two different github repositories (carto-generator, carto-parser).

Carto Generator

The current status of the generator is that it is a nearly feature complete and should be usable by anyone who is interested. As far as I know the only major feature missing from the example is the ability to handle metawriters which is being put off for the time being. However, what this part of the project is lacking is testing and I would certainly appreciate anyone with interest and XML styles to try running the example translator and let me know what breaks. The generator can be run as follows:

$ ./example tests/test.xml

Carto Parser

The second part of the project, and definitely the more important, is the development of a native C++ parser for carto stylesheets. The parsing of the stylesheets occurs in two steps, the first reads the file and builds an abstract syntax tree based on a language grammar and the second traverses the AST and builds the map and related styles.

Parser Next Steps

The current status of the carto parser is that the grammar and AST constructors have been completed with work still being done on the code that translates from the AST into a mapnik map. Hopefully in the next week or two translation of symbolizers will be completed which will allow translation of styles and allow for rendering of simple carto maps. Beyond that work will then be focused on adding carto's special sauce features like variables and mixins.

The current implementation allows for visualization of the AST in a variety of formats (depending on the input filetype) to aid in debugging. Particularly, translation of the AST into the dot format allows the use of graphviz to create visual tree diagrams of a carto style. For example the simple test.mss can be generated as follows (given you have graphviz installed):

$ ./example -o dot tests/test.mss > test.dot$ dot -Tgif test.dot > test.gif

This is a bit more interesting when applied to more complex styles like map.mss which results in this. Similar processing can be done with mml files but the results are much less exciting as the json format is more straightforward than carto.

Testing on OS X

Thanks to some recent work by Dane a statically linked OS X x64 binary is now available on github which will hopefully be useful for anyone interested in trying out the parser without the hassle of updating boost. We will do our best to keep the binary up-to-date as development continues and any testing and or feedback would be greatly appreciated.

Copyright © 2018 Artem Pavlenko | Downloads | License | Media