OpenStreetMap logo OpenStreetMap

Here is the second report from my style parser :

http://osmopenlayers.blogspot.com/2010/06/style-report-from-mapnik.html

code checked in here :
http://github.com/h4ck3rm1k3/GWTOsm in the branch expermental_styles.

Currently the code tracks the fields used in the sql queries and in the stylesheet rules.

I have implemented a rec descent parser for the mapnik style language, and am using the perl standard sql parser for the sql (not all is parsed perfectly)

But it gives you a first view of the key fields used in the style rules.

My first optimization will be to remove all data that is not used in the style information from the main memory. Even if we need to display funky attributes for objects in the detailed view, they can be stored on slower storage if needed.

The next steps will be to find the common conditions the many styles so that we can calculate a class of object just once.
I want to reduce the number of calculations based on the values of 1 or 2 fields in the object, we should be able to use the existing of a key or not to skip over lots of processing. Then for some keys, a simple lookup in a hash table will reduce many more. Then we should be able to evaluate some simple conditions to find the final class.

If this works out, the end result will be a simple automaton that works as a classifier and styler for OSM. it should be a single pass and straight forward to implement.

I have done some experiments with RelaxNG, it is possible to also describe many of the style rules as relaxng groups, but the runtime is not that fast, and the grammer becomes ambigious. You need to look ahead into the tag values to classify the objects.

I would think that in the end, it should be possible to create a better OSM xml that would not need to have lookahead for styling, that would mean creating more tags for the objects.

more to come.

mike

Discussion

Log in to leave a comment