The <icon> section in a <layer> controls the drawing of icons for point objects. Icons are specified using SVG (Scalable Vector Graphics). The <icon> attributes are:

  • canCombine: if the value is "yes" or "true" multiple instances of this icon are combined (at the time of drawing the map) when too close together. By default icons do not combine. Combined icons are given the attribute _combined=N, where N is the number of original icons combined.
  • canOverlap: if the value is "yes" or "true" the icon can overlap other icons. By default icons are not allowed to overlap. Non-overlapping icons are drawn only if they would not overlap other non-overlapping icons. Overlapping icons are always drawn.
  • color: if present, overrides the natural color of the icon as defined by the SVG code; the icon is drawn in monochrome, colorising it using the specified color
  • colorAttrib: the name of a map object attribute giving the color of the icon; the default map object attribute name is _color. Map objects having the specified attribute use it as the icon color.
  • height: height of the icon; when the icon is rendered it is scaled to this height; if width is not set it is calculated automatically, preserving the aspect ratio of the SVG graphics
  • hotSpotX: x coordinate of the icon's hot spot, which is the point on the icon to be positioned at the point of interest on the map; defaults to 50% of the icon's width; percentage values refer to the width of the icon
  • hotSpotY: y coordinate of the icon's hot spot, which is the point on the icon to be positioned at the point of interest on the map; defaults to 50% of the icon's height; percentage values refer to the height of the icon
  • id: the name by which an icon can be referenced elsewhere in the style sheet. Icons can be referenced anywhere after their definition, whether they are defined in a <defs> section or at their point of first use in a layer.
  • labelX, labelY: x and y coordinates of the label position, relative to the hotspot, if a label is to be drawn on top of the icon (as in US Highway shields). The label is centered on this position. Percentage values refer to the width and height of the icon. The default values are both 0, meaning that the label is drawn over the hotspot. Percentage values refer to the height of the icon.
  • priority: the label priority, with the same meaning as it has in <label>; this attribute allows you to set the label priority if a label consists of an icon only. This attribute works only if it is part of the <icon> element in a <layer>, not if it is specified in the <icon> element in the <defs> section.
  • ref: a reference to an icon defined previously in the <defs> section of the style sheet. If a <ref> is present, the <svg> section is taken from the <icon> in the <defs> section.
  • refAttrib: the name of a map object attribute containing the icon reference; if this is specified, for any map objects having the attribute, the value of the attribute is used to select the <icon> from the <defs> section
  • text: the text for an icon made from a character or characters rather than SVG graphics
  • textAttrib: if not empty, the name of a map object attribute giving the icon text, for use with icons consisting of one or more characters. Overrides text.
  • width: width of the icon; when the icon is rendered it is scaled to this width;  if height is not set it is calculated automatically, preserving the aspect ratio of the SVG graphics

Style Sheets Directory