Skip to content

Point icons and icon scaling ​

A point feature is drawn with the icon of its feature style: an object, or an array of icons drawn on top of each other.

Icons ​

  • url draws an image or SVG from a URL. The legacy svg is copied to url.[1]
  • Without url, type (default dot) draws a built-in SVG symbol. An unknown type throws for every feature.[2]
    • dot, target, triangle, square, diamond and semiCircle are filled with fillColor (white) and draw inner shapes from layers, a map of size fractions to colours, eg. { "0.5": "#fff" }.
    • circle is an outline of strokeColor and strokeWidth; markerLetter a pin of color with a letter; markerColor a pin of colorMarker with a dot of colorDot.
    • template draws the locale.svgTemplates entry named by template, replacing each substitute key in the SVG string with its value. Without a loaded template the icon is not drawn.[3] See mapview configuration.
  • scale scales the icon; anchor positions it, [0.5, 0.5] by default.

The rendered scale is icon.scale multiplied by the feature style scale, highlightScale, and the cluster, field and zoom scales computed per feature.[2:1]

Icon scaling ​

layer.style.icon_scaling scales icons by a numeric field: the scale is 1 + value / scaleFactor (or max), negative values do not scale. Cluster icons are only scaled with cluster, summing values, or averaging them with "avg".[4] fields offers named fields in a dropdown; the selected entry is assigned to icon_scaling, and the first entry's field is the default.[1:1]

The ui adds style panel controls unless hidden:[5]

  • icon adds a slider for style.default.scale, from minScale (0.1) to maxScale (three times the scale).
  • clusterScale adds one for style.cluster.clusterScale, shown only when the cluster style sets it.
  • zoomInScale and zoomOutScale add sliders for the layer.style keys, which have no effect (#3154).

Pitfalls ​

  • type and its symbol keys are ignored when url is set. A theme category icon without either is merged with the default icon.

Examples ​

Retail points as lettered markers, drawn as a white dot when highlighted.

json
{
  "dbs": "DEVDB",
  "locale": {
    "layers": {
      "retail_points": {
        "display": true,
        "format": "wkt",
        "table": "geodata.uk_glx_open_retail_points",
        "geom": "geom_p_4326",
        "srid": "4326",
        "qID": "id",
        "style": {
          "default": {
            "icon": {
              "type": "markerLetter",
              "color": "#e66",
              "letter": "R",
              "anchor": [0.5, 1]
            }
          },
          "highlight": { "icon": { "type": "dot", "fillColor": "#fff" } }
        }
      }
    }
  }
}

  1. styleParser.mjs iconUrlSVG and icon_scaling.fields ↩︎ ↩︎

  2. utils/olStyle.mjs iconStyle ↩︎ ↩︎

  3. utils/svgSymbols.mjs ↩︎

  4. featureStyle.mjs iconScalingStyle ↩︎

  5. ui/elements/layerStyle.mjs icon_scaling() ↩︎

XYZ v5.1.0. Generated from knowledge/ at dd7a6fa27736502733499c1bf485f15659b10338. Concepts marked draft are not reviewed.