The <shape> element in a <layer> controls the drawing of polygons. The <shape> attributes are

  • border: the color used to draw the border; omit this if no border is wanted; if it is specified, but borderWidth is omitted, the border is drawn one pixel wide.
  • borderWidth: the width of the border. The width may not be a percentage, because there is no obvious value it could be a percentage of.
  • borderOffset: the amount by which the border is inset (if positive) or moved outwards (if negative).
  • dashArray: a dashed border 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 border (given by the borderWidth attribute). For example, the value '1,2' specifies dashes one unit long and gaps two units long. The list of numbers can be any length.
  • fill: the color used to fill the polygon; omit this if the polygon is not to be filled.
  • height (legal values are 'yes' and 'no'): if 'yes', any suitable map object attributes are used to draw the building in 3D if required. These attributes are _t (top in meters), _b (bottom in meters) and any attribute starting with _roof:.
  • insetBorder (legal values are 'yes' and 'no'): if 'yes', the border is inset by half its width, making it fit inside the polygon.
  • opacity: the opacity of both the fill and border colors. To set the fill and border opacity values separately, use the #RRGGBB or #RRGGBBAA form for specifying the colors.
  • smooth (legal values are 'yes' and 'no'): if 'yes', the polygon is smoothed.

Example:

<shape fill="lightgray" border="darkgray" borderWidth="10m" opacity="0.5"/>

Here is a map using inset borders (insetBorder='yes') for national boundary polygons:

Central America

Style Sheets Directory