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
- name: the name of the layer, which must match the name stored in the map data file or database
- The roadflags attribute is a mask that specifies how a non-road layer uses road attributes for levels, tunnels, bridges and ramps. It overrides the default value, or any global value set in
. You can use lroad='true' as a shortcut for roadflags='#FFFFFFFF'.
The value '#FFFFFFFF' (the # indicates a hexadecimal number) tells CartoType to use the tunnel, bridge, ramp and level attributes for a non-road layer. The value 0 states that none of these attributes are to be used.
You can control the the level, tunnel, bridge and ramp settings separately. The road level is kept in bits 12-15 (mask = #F000), the tunnel flag is bit 0 (mask = #1), the bridge flag is bit 16 (mask = #10000) and the ramp flag is bit 6 (mask = #40). For more details, see TRoadType in the API documentation.
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.
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