The <layer> section

A layer is a named set of map objects of a common type, like roads, parks, or stations. Layers are drawn in the order in which sections appear in the style sheet. The <layer> attributes are:

  • name: the name of the layer, which must match the name stored in the map data file or database
  • road: if 'true' or 'yes', this is a road layer. Setting the road attribute allows layers to be drawn in appropriate order: roads, including tunnels, are drawn after (on top of) objects in earlier layers.

Depending on which sort of objects you expect to find, or wish to draw, in a layer, you should define <shape>, <line> and <icon> sections to specify their appearance.

Layer groups

You can group any number of layers together by enclosing them in a <layerGroup> element. Layer groups exist mainly to allow roads to be split into several layers, to make map drawing faster when minor roads are not needed. Normally, all the objects in a layer are drawn before or after all the objects in another layer, but if you put some layers into a layer group, the objects in the layers are collected together before they are drawn. In the case of roads and other linear objects, this allows their borders to join together properly.

Style Sheets Directory