- Built in
- User provided
- Developing new Styles
- Painter Attributes
- Selection expressions
Styles define how objects in the map are visualised in the editor window. A style contains rules for certain objects, specified by their tag values, that contain drawing parameters like line colour and width, area fill colour, the icon image or the label text format. There are predefined styles that look much like the rendered map. You can edit those styles, add and load them, to visualise features of interest. Examples are styles that colour-key roads by their maxspeed value or that highlight residential roads with no name (much like "Maplint": does, only that you'll get the information directly while you're editing the map). In a way, you can use styles to filter and highlight map objects that you are interested in.
There are a few styles built into Merkaartor, occurring first in version 0.0.10: http://trac.openstreetmap.org/browser/applications/editors/merkaartor/Styles/
Add here a link to any style you want to share with other Merkaartor users. If possible include a screenshot and a little explanation.
Developing new Styles¶
When developing a new style, you are matching certain key/value combinations to a style element. '''The first style element that matches wins''', so the order of the definitions is important.
Painter Attributes¶The style file is made up of xml tags. Each paint rule is contained in ''painter'' tags. The painter tag can have the following attributes that desides how the element is painted (not complete):
- zoomUnder, zoomUpper: Decides for what zoom levels the rule is applied
- backgroundColor, backgroundScale, backgroundOffset: Background color
- foregroundColor, foregroundScale, foregroundOffset: Foreground color
- labelColor, labelScale, labelOffset, labelFont, labelTag: Show a label of the value of the key given by labelTag (e.g. labelTag="name").
- drawTrafficDirectionMarks: Show arrows displaying direction of ways
- icon: For nodes, display an icon at the node. Images can be given an absolute path or relative to the mas-file.
Which elements that are affected by a painter rule is given by a selector tag within the painter tag.
You can combine tags with the "and" operator (example:
[lit] isoneof (1, true, yes) and [highway] isoneof (footway, track, path)). You can also match tags with the wildcards *, ? and  (explained at http://doc.trolltech.com/4.4/qregexp.html#wildcard-matching).
You can also use the specifiers HasTags and "Type is TrackPoint" (Example:
Type is TrackPoint and not HasTags).
In order to check that a key has a value, follow this example:
not [building] is _NULL_
<mapStyle> <painter zoomUnder="0" ...> <selector expr="[highway] is primary"> </painter> ... </mapStyle>