Symbol Layer
A symbol layer draws data from the sourceLayer in the given source as icons and/or text labels.
Parameters
Unique layer name.
Vector data source for this layer.
Layer to use from the given vector tile source.
The minimum zoom level for the layer. At zoom levels less than this, the layer will be hidden. A value in the range of [0..24].
The maximum zoom level for the layer. At zoom levels equal to or greater than this, the layer will be hidden. A value in the range of [0..24].
An expression specifying conditions on source features. Only features that match the filter are displayed. Zoom expressions in filters are only evaluated at integer zoom levels. The featureState expression is not supported in filter expressions.
Whether the layer should be displayed.
Sorts features within this layer in ascending order based on this value. Features with a higher sort key will appear above features with a lower sort key.
Symbol placement relative to its geometry.
Distance between two symbol anchors.
Only applicable when placement is SymbolPlacement.Line.
If true, the symbols will not cross tile edges to avoid mutual collisions. Recommended in layers that don't have enough padding in the vector tile to prevent collisions, or if it is a point symbol layer placed after a line symbol layer.
Determines whether overlapping symbols in the same layer are rendered in the order that they appear in the data source or by their y-position relative to the viewport. To control the order and prioritization of symbols otherwise, use sortKey.
Image to use for drawing an image background.
The opacity at which the icon will be drawn. A value in the range [0..1].
Ignored if iconImage is not specified.
The color of the icon. This can only be used with SDF icons.
Ignored if iconImage is not specified.
The color of the icon's halo. Icon halos can only be used with SDF icons.
Ignored if iconImage is not specified.
Distance of halo to the icon outline. The unit is in dp only for SDF sprites that were created with a blur radius of 8, multiplied by the display density. I.e., the radius needs to be 16 for @2x sprites, etc.
Ignored if iconImage is not specified.
Fade out the halo towards the outside.
Ignored if iconImage is not specified.
Orientation of icon when map is pitched.
Ignored if iconImage is not specified.
Size of the additional area added to dimensions determined by iconTextFit.
Only applicable when if iconTextFit is not IconTextFit.None. Ignored if not both iconImage and textField are specified.
If true, the icon may be flipped to prevent it from being rendered upside-down.
Only applicable if iconRotationAlignment is IconRotationAlignment.Map and placement is either SymbolPlacement.Line or SymbolPlacement.LineCenter.
Ignored if iconImage is not specified.
Rotates the icon clockwise by the number in degrees.
Ignored if iconImage is not specified.
Part of the icon placed closest to the anchor.
Ignored if iconImage is not specified.
Offset distance of icon from its anchor. Positive values indicate right and down, while negative values indicate left and up. Each component is multiplied by the value of iconSize to obtain the final offset in dp. When combined with iconRotate the offset will be as if the rotated direction was up.
Ignored if iconImage is not specified.
Size of additional area round the icon bounding box used for detecting symbol collisions.
Ignored if iconImage is not specified.
If true, the icon will be visible even if it collides with other previously drawn symbols.
Ignored if iconImage is not specified, overridden by iconOverlap, if specified.
Controls whether to show an icon when it overlaps other symbols on the map.
Ignored if iconImage is not specified.
Note: This property is not supported on native platforms yet, see maplibre-native#251**
If true, other symbols can be visible even if they collide with the icon.
Ignored if iconImage is not specified.
The geometry's offset relative to the iconTranslateAnchor. Negative numbers indicate left and up, respectively.
Ignored if iconImage is not specified.
Frame of reference for offsetting geometry.
Ignored if iconTranslate is not set.
Value to use for a text label. Use e.g. format(const("My label")) to display the plain string "My label".
The text can also be formatted, employing different colors, fonts, etc., see format.
The opacity at which the text will be drawn.
Ignored if textField is not specified.
The color with which the text will be drawn.
Ignored if textField is not specified.
The color of the text's halo, which helps it stand out from backgrounds.
Ignored if textField is not specified.
Distance of halo to the font outline. Max text halo width is 1/4 of the font-size.
Ignored if textField is not specified.
The halo's fadeout distance towards the outside.
Ignored if textField is not specified.
Font stack to use for displaying text.
Ignored if textField is not specified.
Font size in SP or EM relative to 16sp.
Ignored if textField is not specified.
Important: If using zoom interpolation for text size, then all other properties defined in text units (like textLetterSpacing, textOffset, etc) MUST be defined in EM units, not SP units. This is a limitation of the MapLibre expression parser. If text size does not use zoom interpolation, then those other properties can be defined in either unit.
Specifies how to capitalize text.
Text tracking amount.
Ignored if textField is not specified.
Orientation of text when map is pitched.
Ignored if textField is not specified.
Maximum angle change in degrees between adjacent characters.
Only applicable if placement is SymbolPlacement.Line or SymbolPlacement.LineCenter
Ignored if textField is not specified.
The maximum line width for text wrapping.
Ignored if textField is not specified.
Text leading value for multi-line text.
Ignored if textField is not specified.
Text justification options.
Ignored if textField is not specified.
The property allows control over a symbol's orientation. Note that the property values act as a hint, so that a symbol whose language doesn’t support the provided orientation will be laid out in its natural orientation. Example: English point symbol will be rendered horizontally even if array value contains single 'vertical' enum value. The order of elements in an array define priority order for the placement of an orientation variant.
Ignored if textField is not specified.
If true, the text may be flipped vertically to prevent it from being rendered upside-down.
Only applicable if textRotationAlignment is TextRotationAlignment.Map and placement is SymbolPlacement.Line or SymbolPlacement.LineCenter
Ignored if textField is not specified.
Rotates the text clockwise. Unit in degrees.
Ignored if textField is not specified.
Part of the text placed closest to the anchor.
Overridden by textVariableAnchorOffset.
Ignored if textField is not specified.
Offset distance of text from its anchor in ems. Positive values indicate right and down, while negative values indicate left and up. If used with textVariableAnchor, input values will be taken as absolute values. Offsets along the x- and y-axis will be applied automatically based on the anchor position.
Overridden by textRadialOffset.
Ignored if textField is not specified.
To increase the chance of placing high-priority labels on the map, you can provide an array of textAnchor locations: the renderer will attempt to place the label at each location, in order, before moving onto the next label. Use textJustify = TextJustify.Auto to choose justification based on anchor position. To apply an offset, use the textRadialOffset or the two-dimensional textOffset.
Only applicable if placement is SymbolPlacement.Point.
Ignored if textField is not specified.
Radial offset of text, in the direction of the symbol's anchor. Useful in combination with textVariableAnchor, which defaults to using the two-dimensional textOffset if present.
Ignored if textField is not specified.
To increase the chance of placing high-priority labels on the map, you can provide an array of SymbolAnchor locations, each paired with an offset value. The renderer will attempt to place the label at each location, in order, before moving on to the next location+offset. Use textJustify = TextJustify.Auto to choose justification based on anchor position.
Each anchor location is accompanied by a point which defines the offset when the corresponding anchor location is used. Positive offset values indicate right and down, while negative values indicate left and up. Anchor locations may repeat, allowing the renderer to try multiple offsets to try and place a label using the same anchor.
When present, this property takes precedence over textAnchor, textVariableAnchor, textOffset and textRadialOffset.
Example:
listOf(
SymbolAnchor.Top to Point(0, 4),
SymbolAnchor.Left to Point(3, 0),
SymbolAnchor.Bottom to Point(1, 1)
)When the renderer chooses the top anchor, 0, 4 will be used for textOffset; the text will be shifted down by 4 ems. When the renderer chooses the left anchor, 3, 0 will be used for textOffset; the text will be shifted right by 3 ems. Etc.
Ignored if textField is not specified.
NOTE: This property is currently not usable: https://github.com/maplibre/maplibre-compose/issues/143
Size of the additional area in dp around the text bounding box used for detecting symbol collisions.
Ignored if textField is not specified.
If true, the text will be visible even if it collides with other previously drawn symbols.
Overridden by textOverlap.
Ignored if textField is not specified.
Controls whether to show an icon/text when it overlaps other symbols on the map. See SymbolOverlap. Overrides textAllowOverlap.
Ignored if textField is not specified.
Note: This property is not supported on native platforms, yet, see maplibre-native#251**
If true, other symbols can be visible even if they collide with the text.
Ignored if textField is not specified.
Distance that the text's anchor is moved from its original placement in dp. Positive values indicate right and down, while negative values indicate left and up.
Ignored if textField is not specified.
Controls the frame of reference for textTranslate.
Ignored if textField is not specified.
Function to call when any feature in this layer has been clicked.
Function to call when any feature in this layer has been long-clicked.