SymbolLayer

fun SymbolLayer(sourceState: SourceState, layerId: String = remember { generateRandomLayerId("symbol") }, iconAllowOverlap: BooleanValue = BooleanValue.INITIAL, iconAnchor: IconAnchorValue = IconAnchorValue.INITIAL, iconIgnorePlacement: BooleanValue = BooleanValue.INITIAL, iconImage: ImageValue = ImageValue.INITIAL, iconKeepUpright: BooleanValue = BooleanValue.INITIAL, iconOffset: DoubleListValue = DoubleListValue.INITIAL, iconOptional: BooleanValue = BooleanValue.INITIAL, iconPadding: DoubleValue = DoubleValue.INITIAL, iconPitchAlignment: IconPitchAlignmentValue = IconPitchAlignmentValue.INITIAL, iconRotate: DoubleValue = DoubleValue.INITIAL, iconRotationAlignment: IconRotationAlignmentValue = IconRotationAlignmentValue.INITIAL, iconSize: DoubleValue = DoubleValue.INITIAL, iconTextFit: IconTextFitValue = IconTextFitValue.INITIAL, iconTextFitPadding: DoubleListValue = DoubleListValue.INITIAL, symbolAvoidEdges: BooleanValue = BooleanValue.INITIAL, symbolPlacement: SymbolPlacementValue = SymbolPlacementValue.INITIAL, symbolSortKey: DoubleValue = DoubleValue.INITIAL, symbolSpacing: DoubleValue = DoubleValue.INITIAL, symbolZElevate: BooleanValue = BooleanValue.INITIAL, symbolZOrder: SymbolZOrderValue = SymbolZOrderValue.INITIAL, textAllowOverlap: BooleanValue = BooleanValue.INITIAL, textAnchor: TextAnchorValue = TextAnchorValue.INITIAL, textField: FormattedValue = FormattedValue.INITIAL, textFont: StringListValue = StringListValue.INITIAL, textIgnorePlacement: BooleanValue = BooleanValue.INITIAL, textJustify: TextJustifyValue = TextJustifyValue.INITIAL, textKeepUpright: BooleanValue = BooleanValue.INITIAL, textLetterSpacing: DoubleValue = DoubleValue.INITIAL, textLineHeight: DoubleValue = DoubleValue.INITIAL, textMaxAngle: DoubleValue = DoubleValue.INITIAL, textMaxWidth: DoubleValue = DoubleValue.INITIAL, textOffset: DoubleListValue = DoubleListValue.INITIAL, textOptional: BooleanValue = BooleanValue.INITIAL, textPadding: DoubleValue = DoubleValue.INITIAL, textPitchAlignment: TextPitchAlignmentValue = TextPitchAlignmentValue.INITIAL, textRadialOffset: DoubleValue = DoubleValue.INITIAL, textRotate: DoubleValue = DoubleValue.INITIAL, textRotationAlignment: TextRotationAlignmentValue = TextRotationAlignmentValue.INITIAL, textSize: DoubleValue = DoubleValue.INITIAL, textTransform: TextTransformValue = TextTransformValue.INITIAL, textVariableAnchor: TextVariableAnchorListValue = TextVariableAnchorListValue.INITIAL, textWritingMode: TextWritingModeListValue = TextWritingModeListValue.INITIAL, iconColor: ColorValue = ColorValue.INITIAL, iconColorTransition: Transition = Transition.INITIAL, iconColorSaturation: DoubleValue = DoubleValue.INITIAL, iconColorSaturationTransition: Transition = Transition.INITIAL, iconEmissiveStrength: DoubleValue = DoubleValue.INITIAL, iconEmissiveStrengthTransition: Transition = Transition.INITIAL, iconHaloBlur: DoubleValue = DoubleValue.INITIAL, iconHaloBlurTransition: Transition = Transition.INITIAL, iconHaloColor: ColorValue = ColorValue.INITIAL, iconHaloColorTransition: Transition = Transition.INITIAL, iconHaloWidth: DoubleValue = DoubleValue.INITIAL, iconHaloWidthTransition: Transition = Transition.INITIAL, iconImageCrossFade: DoubleValue = DoubleValue.INITIAL, iconImageCrossFadeTransition: Transition = Transition.INITIAL, iconOcclusionOpacity: DoubleValue = DoubleValue.INITIAL, iconOcclusionOpacityTransition: Transition = Transition.INITIAL, iconOpacity: DoubleValue = DoubleValue.INITIAL, iconOpacityTransition: Transition = Transition.INITIAL, iconTranslate: DoubleListValue = DoubleListValue.INITIAL, iconTranslateTransition: Transition = Transition.INITIAL, iconTranslateAnchor: IconTranslateAnchorValue = IconTranslateAnchorValue.INITIAL, textColor: ColorValue = ColorValue.INITIAL, textColorTransition: Transition = Transition.INITIAL, textEmissiveStrength: DoubleValue = DoubleValue.INITIAL, textEmissiveStrengthTransition: Transition = Transition.INITIAL, textHaloBlur: DoubleValue = DoubleValue.INITIAL, textHaloBlurTransition: Transition = Transition.INITIAL, textHaloColor: ColorValue = ColorValue.INITIAL, textHaloColorTransition: Transition = Transition.INITIAL, textHaloWidth: DoubleValue = DoubleValue.INITIAL, textHaloWidthTransition: Transition = Transition.INITIAL, textOcclusionOpacity: DoubleValue = DoubleValue.INITIAL, textOcclusionOpacityTransition: Transition = Transition.INITIAL, textOpacity: DoubleValue = DoubleValue.INITIAL, textOpacityTransition: Transition = Transition.INITIAL, textTranslate: DoubleListValue = DoubleListValue.INITIAL, textTranslateTransition: Transition = Transition.INITIAL, textTranslateAnchor: TextTranslateAnchorValue = TextTranslateAnchorValue.INITIAL, visibility: VisibilityValue = VisibilityValue.INITIAL, minZoom: LongValue = LongValue.INITIAL, maxZoom: LongValue = LongValue.INITIAL, sourceLayer: StringValue = StringValue.INITIAL, filter: Filter = Filter.INITIAL)

An icon or a text label.

See also

Parameters

sourceState

the source that drives this layer.

layerId

the ID of the layer, by default, a random id will be generated with UUID.

iconAllowOverlap

If true, the icon will be visible even if it collides with other previously drawn symbols. Default value: false.

iconAnchor

Part of the icon placed closest to the anchor. Default value: "center".

iconIgnorePlacement

If true, other symbols can be visible even if they collide with the icon. Default value: false.

iconImage

Name of image in sprite to use for drawing an image background.

iconKeepUpright

If true, the icon may be flipped to prevent it from being rendered upside-down. Default value: false.

iconOffset

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 icon-size to obtain the final offset in pixels. When combined with icon-rotate the offset will be as if the rotated direction was up. Default value: 0,0.

iconOptional

If true, text will display without their corresponding icons when the icon collides with other symbols and the text does not. Default value: false.

iconPadding

Size of the additional area around the icon bounding box used for detecting symbol collisions. Default value: 2. Minimum value: 0.

iconPitchAlignment

Orientation of icon when map is pitched. Default value: "auto".

iconRotate

Rotates the icon clockwise. Default value: 0.

iconRotationAlignment

In combination with symbol-placement, determines the rotation behavior of icons. Default value: "auto".

iconSize

Scales the original size of the icon by the provided factor. The new pixel size of the image will be the original pixel size multiplied by icon-size. 1 is the original size; 3 triples the size of the image. Default value: 1. Minimum value: 0.

iconTextFit

Scales the icon to fit around the associated text. Default value: "none".

iconTextFitPadding

Size of the additional area added to dimensions determined by icon-text-fit, in clockwise order: top, right, bottom, left. Default value: 0,0,0,0.

symbolAvoidEdges

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. When using a client that supports global collision detection, like Mapbox GL JS version 0.42.0 or greater, enabling this property is not needed to prevent clipped labels at tile boundaries. Default value: false.

symbolPlacement

Label placement relative to its geometry. Default value: "point".

symbolSortKey

Sorts features in ascending order based on this value. Features with lower sort keys are drawn and placed first. When icon-allow-overlap or text-allow-overlap is false, features with a lower sort key will have priority during placement. When icon-allow-overlap or text-allow-overlap is set to true, features with a higher sort key will overlap over features with a lower sort key.

symbolSpacing

Distance between two symbol anchors. Default value: 250. Minimum value: 1.

symbolZElevate

Position symbol on buildings (both fill extrusions and models) rooftops. In order to have minimal impact on performance, this is supported only when fill-extrusion-height is not zoom-dependent and remains unchanged. For fading in buildings when zooming in, fill-extrusion-vertical-scale should be used and symbols would raise with building rooftops. Symbols are sorted by elevation, except in cases when viewport-y sorting or symbol-sort-key are applied. Default value: false.

symbolZOrder

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 symbol-sort-key. Default value: "auto".

textAllowOverlap

If true, the text will be visible even if it collides with other previously drawn symbols. Default value: false.

textAnchor

Part of the text placed closest to the anchor. Default value: "center".

textField

Value to use for a text label. If a plain string is provided, it will be treated as a formatted with default/inherited formatting options. SDF images are not supported in formatted text and will be ignored. Default value: "".

textFont

Font stack to use for displaying text.

textIgnorePlacement

If true, other symbols can be visible even if they collide with the text. Default value: false.

textJustify

Text justification options. Default value: "center".

textKeepUpright

If true, the text may be flipped vertically to prevent it from being rendered upside-down. Default value: true.

textLetterSpacing

Text tracking amount. Default value: 0.

textLineHeight

Text leading value for multi-line text. Default value: 1.2.

textMaxAngle

Maximum angle change between adjacent characters. Default value: 45.

textMaxWidth

The maximum line width for text wrapping. Default value: 10. Minimum value: 0.

textOffset

Offset distance of text from its anchor. Positive values indicate right and down, while negative values indicate left and up. If used with text-variable-anchor, input values will be taken as absolute values. Offsets along the x- and y-axis will be applied automatically based on the anchor position. Default value: 0,0.

textOptional

If true, icons will display without their corresponding text when the text collides with other symbols and the icon does not. Default value: false.

textPadding

Size of the additional area around the text bounding box used for detecting symbol collisions. Default value: 2. Minimum value: 0.

textPitchAlignment

Orientation of text when map is pitched. Default value: "auto".

textRadialOffset

Radial offset of text, in the direction of the symbol's anchor. Useful in combination with text-variable-anchor, which defaults to using the two-dimensional text-offset if present. Default value: 0.

textRotate

Rotates the text clockwise. Default value: 0.

textRotationAlignment

In combination with symbol-placement, determines the rotation behavior of the individual glyphs forming the text. Default value: "auto".

textSize

Font size. Default value: 16. Minimum value: 0.

textTransform

Specifies how to capitalize text, similar to the CSS text-transform property. Default value: "none".

textVariableAnchor

To increase the chance of placing high-priority labels on the map, you can provide an array of text-anchor locations: the renderer will attempt to place the label at each location, in order, before moving onto the next label. Use text-justify: auto to choose justification based on anchor position. To apply an offset, use the text-radial-offset or the two-dimensional text-offset.

textWritingMode

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. For symbol with point placement, the order of elements in an array define priority order for the placement of an orientation variant. For symbol with line placement, the default text writing mode is either 'horizontal', 'vertical' or 'vertical', 'horizontal', the order doesn't affect the placement.

iconColor

The color of the icon. This can only be used with /help/troubleshooting/using-recolorable-images-in-mapbox-maps/. Default value: "#000000".

iconColorTransition

Defines the transition of iconColor. Default value: "#000000".

iconColorSaturation

Increase or reduce the saturation of the symbol icon. Default value: 0. Value range: -1, 1

iconColorSaturationTransition

Defines the transition of iconColorSaturation. Default value: 0. Value range: -1, 1

iconEmissiveStrength

Controls the intensity of light emitted on the source features. Default value: 1. Minimum value: 0.

iconEmissiveStrengthTransition

Defines the transition of iconEmissiveStrength. Default value: 1. Minimum value: 0.

iconHaloBlur

Fade out the halo towards the outside. Default value: 0. Minimum value: 0.

iconHaloBlurTransition

Defines the transition of iconHaloBlur. Default value: 0. Minimum value: 0.

iconHaloColor

The color of the icon's halo. Icon halos can only be used with /help/troubleshooting/using-recolorable-images-in-mapbox-maps/. Default value: "rgba(0, 0, 0, 0)".

iconHaloColorTransition

Defines the transition of iconHaloColor. Default value: "rgba(0, 0, 0, 0)".

iconHaloWidth

Distance of halo to the icon outline. Default value: 0. Minimum value: 0.

iconHaloWidthTransition

Defines the transition of iconHaloWidth. Default value: 0. Minimum value: 0.

iconImageCrossFade

Controls the transition progress between the image variants of icon-image. Zero means the first variant is used, one is the second, and in between they are blended together. Default value: 0. Value range: 0, 1

iconImageCrossFadeTransition

Defines the transition of iconImageCrossFade. Default value: 0. Value range: 0, 1

iconOcclusionOpacity

The opacity at which the icon will be drawn in case of being depth occluded. Not supported on globe zoom levels. Default value: 1. Value range: 0, 1

iconOcclusionOpacityTransition

Defines the transition of iconOcclusionOpacity. Default value: 1. Value range: 0, 1

iconOpacity

The opacity at which the icon will be drawn. Default value: 1. Value range: 0, 1

iconOpacityTransition

Defines the transition of iconOpacity. Default value: 1. Value range: 0, 1

iconTranslate

Distance that the icon's anchor is moved from its original placement. Positive values indicate right and down, while negative values indicate left and up. Default value: 0,0.

iconTranslateTransition

Defines the transition of iconTranslate. Default value: 0,0.

iconTranslateAnchor

Controls the frame of reference for icon-translate. Default value: "map".

textColor

The color with which the text will be drawn. Default value: "#000000".

textColorTransition

Defines the transition of textColor. Default value: "#000000".

textEmissiveStrength

Controls the intensity of light emitted on the source features. Default value: 1. Minimum value: 0.

textEmissiveStrengthTransition

Defines the transition of textEmissiveStrength. Default value: 1. Minimum value: 0.

textHaloBlur

The halo's fadeout distance towards the outside. Default value: 0. Minimum value: 0.

textHaloBlurTransition

Defines the transition of textHaloBlur. Default value: 0. Minimum value: 0.

textHaloColor

The color of the text's halo, which helps it stand out from backgrounds. Default value: "rgba(0, 0, 0, 0)".

textHaloColorTransition

Defines the transition of textHaloColor. Default value: "rgba(0, 0, 0, 0)".

textHaloWidth

Distance of halo to the font outline. Max text halo width is 1/4 of the font-size. Default value: 0. Minimum value: 0.

textHaloWidthTransition

Defines the transition of textHaloWidth. Default value: 0. Minimum value: 0.

textOcclusionOpacity

The opacity at which the text will be drawn in case of being depth occluded. Not supported on globe zoom levels. Default value: 1. Value range: 0, 1

textOcclusionOpacityTransition

Defines the transition of textOcclusionOpacity. Default value: 1. Value range: 0, 1

textOpacity

The opacity at which the text will be drawn. Default value: 1. Value range: 0, 1

textOpacityTransition

Defines the transition of textOpacity. Default value: 1. Value range: 0, 1

textTranslate

Distance that the text's anchor is moved from its original placement. Positive values indicate right and down, while negative values indicate left and up. Default value: 0,0.

textTranslateTransition

Defines the transition of textTranslate. Default value: 0,0.

textTranslateAnchor

Controls the frame of reference for text-translate. Default value: "map".

visibility

Whether this layer is displayed. Default value: "visible".

minZoom

The minimum zoom level for the layer. At zoom levels less than the minzoom, the layer will be hidden. Value range: 0, 24

maxZoom

The maximum zoom level for the layer. At zoom levels equal to or greater than the maxzoom, the layer will be hidden. Value range: 0, 24

sourceLayer

Layer to use from a vector tile source. Required for vector tile sources; prohibited for all other source types, including GeoJSON sources.

filter

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 ["feature-state", ...] expression is not supported in filter expressions. The ["pitch"] and ["distance-from-center"] expressions are supported only for filter expressions on the symbol layer.