Symbol Layer
An icon or a text label.
See also
Parameters
Constructors
the ID of the layer
Types
Functions
Properties
A 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.
If true, the icon will be visible even if it collides with other previously drawn symbols.
This is an Expression representation of "icon-allow-overlap".
If true, the icon will be visible even if it collides with other previously drawn symbols.
Part of the icon placed closest to the anchor.
This is an Expression representation of "icon-anchor".
Part of the icon placed closest to the anchor.
The color of the icon. This can only be used with sdf icons.
This is an Expression representation of "icon-color".
The color of the icon. This can only be used with sdf icons.
Transition options for IconColor.
Fade out the halo towards the outside.
This is an Expression representation of "icon-halo-blur".
Fade out the halo towards the outside.
Transition options for IconHaloBlur.
The color of the icon's halo. Icon halos can only be used with SDF icons.
The color of the icon's halo. Icon halos can only be used with SDF icons.
This is an Expression representation of "icon-halo-color".
The color of the icon's halo. Icon halos can only be used with SDF icons.
Transition options for IconHaloColor.
Distance of halo to the icon outline.
This is an Expression representation of "icon-halo-width".
Distance of halo to the icon outline.
Transition options for IconHaloWidth.
If true, other symbols can be visible even if they collide with the icon.
This is an Expression representation of "icon-ignore-placement".
If true, other symbols can be visible even if they collide with the icon.
This is an Expression representation of "icon-image".
Name of image in sprite to use for drawing an image background.
If true, the icon may be flipped to prevent it from being rendered upside-down.
This is an Expression representation of "icon-keep-upright".
If true, the icon may be flipped to prevent it from being rendered upside-down.
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.
This is an Expression representation of "icon-offset".
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.
The opacity at which the icon will be drawn.
This is an Expression representation of "icon-opacity".
The opacity at which the icon will be drawn.
Transition options for IconOpacity.
If true, text will display without their corresponding icons when the icon collides with other symbols and the text does not.
This is an Expression representation of "icon-optional".
If true, text will display without their corresponding icons when the icon collides with other symbols and the text does not.
Size of the additional area around the icon bounding box used for detecting symbol collisions.
This is an Expression representation of "icon-padding".
Size of the additional area around the icon bounding box used for detecting symbol collisions.
Orientation of icon when map is pitched.
This is an Expression representation of "icon-pitch-alignment".
Orientation of icon when map is pitched.
Rotates the icon clockwise.
This is an Expression representation of "icon-rotate".
Rotates the icon clockwise.
In combination with symbol-placement
, determines the rotation behavior of icons.
This is an Expression representation of "icon-rotation-alignment".
In combination with symbol-placement
, determines the rotation behavior of icons.
This is an Expression representation of "icon-size".
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.
Scales the icon to fit around the associated text.
This is an Expression representation of "icon-text-fit".
Scales the icon to fit around the associated text.
Size of the additional area added to dimensions determined by icon-text-fit
, in clockwise order: top, right, bottom, left.
This is an Expression representation of "icon-text-fit-padding".
Size of the additional area added to dimensions determined by icon-text-fit
, in clockwise order: top, right, bottom, left.
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.
Controls the frame of reference for icon-translate
.
This is an Expression representation of "icon-translate-anchor".
Controls the frame of reference for icon-translate
.
This is an Expression representation of "icon-translate".
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.
Transition options for IconTranslate.
Properties of this layer.
Source layer.
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.
This is an Expression representation of "symbol-avoid-edges".
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.
Label placement relative to its geometry.
This is an Expression representation of "symbol-placement".
Label placement relative to its geometry.
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.
This is an Expression representation of "symbol-sort-key".
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.
Distance between two symbol anchors.
This is an Expression representation of "symbol-spacing".
Distance between two symbol anchors.
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
.
This is an Expression representation of "symbol-z-order".
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
.
If true, the text will be visible even if it collides with other previously drawn symbols.
This is an Expression representation of "text-allow-overlap".
If true, the text will be visible even if it collides with other previously drawn symbols.
Part of the text placed closest to the anchor.
This is an Expression representation of "text-anchor".
Part of the text placed closest to the anchor.
The color with which the text will be drawn.
This is an Expression representation of "text-color".
The color with which the text will be drawn.
Transition options for TextColor.
This is an Expression representation of "text-field".
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.
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.
This is an Expression representation of "text-font".
Font stack to use for displaying text.
The halo's fadeout distance towards the outside.
This is an Expression representation of "text-halo-blur".
The halo's fadeout distance towards the outside.
Transition options for TextHaloBlur.
The color of the text's halo, which helps it stand out from backgrounds.
The color of the text's halo, which helps it stand out from backgrounds.
This is an Expression representation of "text-halo-color".
The color of the text's halo, which helps it stand out from backgrounds.
Transition options for TextHaloColor.
Distance of halo to the font outline. Max text halo width is 1/4 of the font-size.
This is an Expression representation of "text-halo-width".
Distance of halo to the font outline. Max text halo width is 1/4 of the font-size.
Transition options for TextHaloWidth.
If true, other symbols can be visible even if they collide with the text.
This is an Expression representation of "text-ignore-placement".
If true, other symbols can be visible even if they collide with the text.
Text justification options.
This is an Expression representation of "text-justify".
Text justification options.
If true, the text may be flipped vertically to prevent it from being rendered upside-down.
This is an Expression representation of "text-keep-upright".
If true, the text may be flipped vertically to prevent it from being rendered upside-down.
Text tracking amount.
This is an Expression representation of "text-letter-spacing".
Text tracking amount.
Text leading value for multi-line text.
This is an Expression representation of "text-line-height".
Text leading value for multi-line text.
Maximum angle change between adjacent characters.
This is an Expression representation of "text-max-angle".
Maximum angle change between adjacent characters.
The maximum line width for text wrapping.
This is an Expression representation of "text-max-width".
The maximum line width for text wrapping.
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.
This is an Expression representation of "text-offset".
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.
The opacity at which the text will be drawn.
This is an Expression representation of "text-opacity".
The opacity at which the text will be drawn.
Transition options for TextOpacity.
If true, icons will display without their corresponding text when the text collides with other symbols and the icon does not.
This is an Expression representation of "text-optional".
If true, icons will display without their corresponding text when the text collides with other symbols and the icon does not.
Size of the additional area around the text bounding box used for detecting symbol collisions.
This is an Expression representation of "text-padding".
Size of the additional area around the text bounding box used for detecting symbol collisions.
Orientation of text when map is pitched.
This is an Expression representation of "text-pitch-alignment".
Orientation of text when map is pitched.
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.
This is an Expression representation of "text-radial-offset".
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.
Rotates the text clockwise.
This is an Expression representation of "text-rotate".
Rotates the text clockwise.
In combination with symbol-placement
, determines the rotation behavior of the individual glyphs forming the text.
This is an Expression representation of "text-rotation-alignment".
In combination with symbol-placement
, determines the rotation behavior of the individual glyphs forming the text.
This is an Expression representation of "text-size".
Font size.
Specifies how to capitalize text, similar to the CSS text-transform
property.
This is an Expression representation of "text-transform".
Specifies how to capitalize text, similar to the CSS text-transform
property.
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.
Controls the frame of reference for text-translate
.
This is an Expression representation of "text-translate-anchor".
Controls the frame of reference for text-translate
.
This is an Expression representation of "text-translate".
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.
Transition options for TextTranslate.
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
.
This is an Expression representation of "text-variable-anchor".
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
.
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.
This is an Expression representation of "text-writing-mode".
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.
Visibility of the layer.