May 24, 2011
Since yesterday was the official start date of the Google Summer of Code 2011, Dane asked me to post a little about my project and what I hope to accomplish over the next several months.
My project is focused on bringing native parsers for the Carto and Cascadenik map stylesheets into the core Mapnik library with fast implementations in C++. Currently parsers for these stylesheet formats are only available in javascript and python respectively which is somewhat restrictive for many of Mapnik's use cases. A core implementation of these specifications will make these stylesheet formats available to the widest possible audience of Mapnik users and will keep the styling specifications closely tied to internal Mapnik styling implementation which will hopefully improve performance and maintainability in the long run.
The first stage of this project, and what I have started work on, is the implementation of a parser for Carto which takes a Carto stylesheet and generates an abstract syntax tree from it. This is being done using Boost Spirit which is a beautiful set of C++ libraries for parsing and output generation of domain specific embedded languages. This initial work will not be immediately useful for mapping as it is still necessary to translate the AST to Mapnik's internal map representation but it is an important first step in the parsing processes. You can follow progress on this work on my github page and my GSoC branch on the Mapnik SVN.
The github page also contains some initial work on a Carto generator which reads in an XML style file and translates into a Carto stylesheet. At this point the output is (nearly) valid Carto syntax and while it does not use many of the more advanced features of Carto (nested styles, mixins, functions, etc.) it should give a good sense of what the Carto equivalent of a XML style file should look like. This software depends on Mapnik2 with changes that are currently only present in my GSoC branch and Boost 1.47 (svn trunk) if you are interested in trying it out.