The <line> element in a <layer> controls the drawing of lines, the most important of which are roads. Some attributes apply only to roads. The <line> attributes are

  • fill: the color used for the interior of the line
  • border: the color of the borders of the line
  • centerLine: (for roads only) the color of the center line of a road; used for major divided highways
  • width: the width of the line
  • borderWidth: the width of the borders; percentage values refer to the width of the line
  • centerLineWidth: (for roads only) the width of the center line; percentage values refer to the width of the road
  • opacity: the opacity of all features - line, border and center line. To set opacity values separately use the #RRGGBB or #RRGGBBAA form for specifying the colors
  • antiAlias: (allowed values: "true" or "false") if true (the default value) use anti-aliasing to draw the line and its border more smoothly.
  • dashArray: a dashed line can be drawn by supplying a list of numbers giving the lengths of the filled-in sections and the gaps between them, in units of the width of the line. For example, the value '1,2' specifies dashes one unit long and gaps two units long. The list of numbers can be any length.

Example of a line that is not a road (in this case, a river):

<line width="20m" fill="lightblue"/>

Example of a line that is a road (in this case, a secondary road):

<line width="22m,2pt" fill="orange" border="black" borderWidth="5%" centerLine="white" centerLineWidth="5%"/>

Example of a railway drawn using white dashes with a grey border and background:

<line width='12m,2pt' border='grey' borderWidth='10%,0.7,2' fill='white' dashArray='5,5'/>

You can use the <highlight> element add extra lines to highlight a road. For example, you might want to place a green line next to scenic routes:

<highlight distance="7m@6000_42m@75000" fill="green" width="1m@6000_6m@75000,1.5pt">

The distance attribute gives the distance from the center line of the road: positive for the right hand side relative to the direction in which the road is stored, and negative for the left hand side.

Style Sheets Directory