Stylesheets and GSOC - Halfway
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).
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
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 produces the following output:
which 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.Posted by Colin Rundel on 18 July 2011.