SymbolLayerOptions interface

Options used when rendering geometries in a SymbolLayer.

Extends

Properties

iconOptions

Options used to customize the icons of the symbols.

See IconOptions for defaults.

lineSpacing

Distance in pixels between two symbol anchors along a line. Must be greater or equal to 1. Default 250.

placement

Specifies the label placement relative to its geometry.
"point": The label is placed at the point where the geometry is located.
"line": The label is placed along the line of the geometry. Can only be used on LineString and Polygon geometries.
"line-center": The label is placed at the center of the line of the geometry. Can only be used on LineString and Polygon geometries
Default "point".

sortKey

Sorts features in ascending order based on this value. Features with lower sort keys are drawn and placed first. Default undefined.

source

The id or instance of a data source which the layer will render.

sourceLayer

Required when the source of the layer is a VectorTileSource. A vector source can have multiple layers within it, this identifies which one to render in this layer. Prohibited for all other types of sources.

textOptions

Options used to customize the text of the symbols.

See TextOptions for defaults.

zOrder

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.
"auto": Sorts symbols by sortKey if set. Otherwise behaves like "viewport-y".
"viewport-y": Sorts symbols by their y position if allowOverlap is true or if ignorePlacement is false.
"source": Sorts symbols by sortKey if set. Otherwise, symbols are rendered in the same order as the source data.
Default "auto"

Inherited Properties

filter

An expression specifying conditions on source features. Only features that match the filter are displayed.

maxZoom

An integer specifying the maximum zoom level to render the layer at. This value is exclusive, i.e. the layer will be visible at maxZoom > zoom >= minZoom. Default 24.

minZoom

An integer specifying the minimum zoom level to render the layer at. This value is inclusive, i.e. the layer will be visible at maxZoom > zoom >= minZoom. Default 0.

visible

Specifies if the layer is visible or not. Default true.

Property Details

iconOptions

Options used to customize the icons of the symbols.

See IconOptions for defaults.

iconOptions?: IconOptions

Property Value

lineSpacing

Distance in pixels between two symbol anchors along a line. Must be greater or equal to 1. Default 250.

lineSpacing?: number | PropertyValueSpecification<number>

Property Value

number | PropertyValueSpecification<number>

placement

Specifies the label placement relative to its geometry.
"point": The label is placed at the point where the geometry is located.
"line": The label is placed along the line of the geometry. Can only be used on LineString and Polygon geometries.
"line-center": The label is placed at the center of the line of the geometry. Can only be used on LineString and Polygon geometries
Default "point".

placement?: "point" | "line" | "line-center"

Property Value

"point" | "line" | "line-center"

sortKey

Sorts features in ascending order based on this value. Features with lower sort keys are drawn and placed first. Default undefined.

sortKey?: number | DataDrivenPropertyValueSpecification<number>

Property Value

number | DataDrivenPropertyValueSpecification<number>

source

The id or instance of a data source which the layer will render.

source?: string | Source

Property Value

string | Source

sourceLayer

Required when the source of the layer is a VectorTileSource. A vector source can have multiple layers within it, this identifies which one to render in this layer. Prohibited for all other types of sources.

sourceLayer?: string

Property Value

string

textOptions

Options used to customize the text of the symbols.

See TextOptions for defaults.

textOptions?: TextOptions

Property Value

zOrder

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.
"auto": Sorts symbols by sortKey if set. Otherwise behaves like "viewport-y".
"viewport-y": Sorts symbols by their y position if allowOverlap is true or if ignorePlacement is false.
"source": Sorts symbols by sortKey if set. Otherwise, symbols are rendered in the same order as the source data.
Default "auto"

zOrder?: "auto" | "viewport-y" | "source"

Property Value

"auto" | "viewport-y" | "source"

Inherited Property Details

filter

An expression specifying conditions on source features. Only features that match the filter are displayed.

filter?: Expression

Property Value

Inherited From LayerOptions.filter

maxZoom

An integer specifying the maximum zoom level to render the layer at. This value is exclusive, i.e. the layer will be visible at maxZoom > zoom >= minZoom. Default 24.

maxZoom?: number

Property Value

number

Inherited From LayerOptions.maxZoom

minZoom

An integer specifying the minimum zoom level to render the layer at. This value is inclusive, i.e. the layer will be visible at maxZoom > zoom >= minZoom. Default 0.

minZoom?: number

Property Value

number

Inherited From LayerOptions.minZoom

visible

Specifies if the layer is visible or not. Default true.

visible?: boolean

Property Value

boolean

Inherited From LayerOptions.visible