OpenStreetMap

I finally got around to setting up my own tileserver with the idea of playing around with the mapnik stylesheet to try to resolve some of the issues it has. I have noticed that there are a lot of issue (~300) currently outstanding against the mapnik sheet and only about 3 names in the "assigned to" fields of these tickets, so I have decided to try working through some of them on my local tile server here so I can submit patches to the trac tickets allowing them to be resolved.

In doing this however I see that there are many "duplicate" rules in the stylesheet. There are several ways in which the duplication occurs and some of it makes sense (progressively more specific rules about a certain road type for example), but some of these are redundant, or even outright copies in the filter string with different styles specified for the exact same set of roads, meaning that it can be very difficult to find out which rule even applies to a given way.

I will try to put some patches together to remove some of the more egregious duplicate entries and submit them shortly via trac tickets. If anyone has any insight into why there seems to be so much duplication I would appreciate your insight as I am new to mapnik and have much to learn. Feel free to either respond to this diary entry, or get in touch with me on Skype (username andrewbuck40) if you want to text/voice chat about this, or any other mapnik style related issues.

-Buck

Comment from Richard on 19 July 2011 at 16:58

Suggest you post this to the dev@ mailing list.

Comment from AndrewBuck on 19 July 2011 at 17:27

Actually I am starting to make more sense of it. I am using a proper XML editor now, rather than just a normal text editor, and I see that the rules are duplicated because there is both a minor-roads-casing and a minor-roads-fill style sections. This is why I was seeing so many duplicate rules, as each road type seems to have an entry in the corresponding casing/fill style for that object type.

Although this explains the duplicated filters and zoom-level parameters, I don't understand the reason for having separate style sections with so much duplication. It seems to me you would want one clause with a single filter string to match the road type once, and then under that rule you list more than one entry to do both the casing and the fill in one place. Having them in two separate sections like this makes it much harder to understand what is actually going on and means that any change to how the roads look needs to be done in two distantly separated places in this huge file.

-Buck

Comment from AndrewBuck on 19 July 2011 at 17:49

Ahh, it looks like the fill/casing are done as separate rules so that they can be rendered as separate layers when the image is built up. Guess it's going to take quite a bit of poking around the file to really get a sense of how things are layed out and how they interact with eachother.

-Buck

Comment from Tom Chance on 20 July 2011 at 14:29

You'll find the default OSM stylesheet is a bewildering, painstaking work of love!

Try starting your own stylesheet and you'll quickly realise how much copying & pasting you need to get even a half-decent map.

Comment from bastik on 20 July 2011 at 18:01

I noticed some oddities as well, e.g. castle_walls layer is duplicated.

http://trac.openstreetmap.org/browser/applications/rendering/mapnik/inc/layer-citywall.xml.inc#L57


Login to leave a comment