API and agentsAPI reference
Style
object
A layer's full visual definition. Constant channels plus data-driven ones: strokeBy drives the outline color like fill drives the fill; pointRadiusBy and strokeWidthBy drive the sizes. Absent data-driven members mean the constant siblings apply.
fillFillPaintfillOpacitynumber0-1 fill translucency; 1 = opaque. Colors are solid — the sliders own alpha. Default 1.
strokeobjectConstant outline color {r, g, b, a}.
strokeOpacitynumber0-1 multiplier on the stroke alpha. Default 1.
strokeWidthnumberpointRadiusnumberopacitynumberstrokeByFillPaintData-driven outline color; overrides
strokewhen present.pointRadiusBySizeScaleData-driven point radius; overrides
pointRadius.strokeWidthBySizeScaleData-driven line/outline width; overrides
strokeWidth.heightBySizeScalePolygon extrusion by attribute: the domain maps linearly onto meters (range up to 100000; resolve with the scale operation, unit 'm'). Omit for flat.
labelobjectText labels on the layer; omit for none. On a simple-feature layer set
attributeto the column whose value labels each feature (points at the point, lines and polygons at an interior anchor). On an aggregated hex/grid layer omitattribute— each cell labels itself with its aggregate value, compactly formatted. Heatmaps cannot be labeled.attributestringLabel source column; omit on aggregated layers.
sizenumberrequiredText size, 1-72; 12 is a good default. On simple layers this is screen pixels. On hex/grid layers it scales the label's proportion of its cell — cell labels zoom with the map, like the cells themselves.
colorobjectrequiredText color {r, g, b, a}. Pick against the basemap: white reads well on dark styles and imagery, a dark color on light styles.
haloWidthnumberrequiredHalo rim behind the text, 0 (none) to 3 (widest). Replaced the legacy
haloboolean: stored maps migrate on read; writes stating the boolean answer invalid_request.haloColorobjectrequiredHalo color {r, g, b, a}.
weightstringAbsent = normal.
One of
normal,boldanchorstringOne of the nine compass positions plus center, relative to the feature's anchor point; absent = center.
offsetXnumberPixels, -50 to 50; +x right. Absent = 0.
offsetYnumberPixels, -50 to 50; +y down. Absent = 0.
rotationnumberDegrees, -180 to 180, counter-clockwise positive. Absent = 0.
textCasestringApplied before truncation. Absent = as-is.
One of
as-is,upper,lowermaxCharsnumberor nullTruncate to N code points with an ellipsis (not counted), 1 to 80; null/absent = no truncation.
densitynumberCollision-culling density, 0 sparse to 1 dense; absent = 0.5. Table-backed layers only — tiled layers are exempt from thinning.
zoomFloornumberor nullShow labels from this whole zoom level (0-24); null/absent = no floor.
priorityFieldstringor nullNumeric column ranking which labels survive the cap and collisions (higher wins; nulls last); null/absent = stable feature order. Published maps carry the column's values.
capnumberor nullDraw at most N labels (1-10000), after ranking; null/absent = no cap.
No other keys.
7439201b