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
urldraws an image or SVG from a URL. The legacysvgis copied tourl.[1]- Without
url,type(defaultdot) draws a built-in SVG symbol. An unknown type throws for every feature.[2]dot,target,triangle,square,diamondandsemiCircleare filled withfillColor(white) and draw inner shapes fromlayers, a map of size fractions to colours, eg.{ "0.5": "#fff" }.circleis an outline ofstrokeColorandstrokeWidth;markerLettera pin ofcolorwith aletter;markerColora pin ofcolorMarkerwith a dot ofcolorDot.templatedraws thelocale.svgTemplatesentry named bytemplate, replacing eachsubstitutekey in the SVG string with its value. Without a loaded template the icon is not drawn.[3] See mapview configuration.
scalescales the icon;anchorpositions 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]
iconadds a slider forstyle.default.scale, fromminScale(0.1) tomaxScale(three times the scale).clusterScaleadds one forstyle.cluster.clusterScale, shown only when the cluster style sets it.zoomInScaleandzoomOutScaleadd sliders for the layer.style keys, which have no effect (#3154).
Pitfalls
typeand its symbol keys are ignored whenurlis 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.
{
"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" } }
}
}
}
}
}