LineLayerOptions interface

Options used when rendering SimpleLine, SimplePolygon, CirclePolygon, LineString, MultiLineString, Polygon, and MultiPolygon objects in a line layer.

Extends

Properties

blur

The amount of blur to apply to the line in pixels. Default 0.

lineCap

Specifies how the ends of the lines are rendered.

`"butt"`: A cap with a squared-off end which is drawn to the exact endpoint of the line.

`"round"`: A cap with a rounded end which is drawn beyond the endpoint of the line at a radius of one-half of the lines width and centered on the endpoint of the line.

`"square"`: A cap with a squared-off end which is drawn beyond the endpoint of the line at a distance of one-half of the line width.

Default `"round"`.
lineJoin

Specifies how the joints in the lines are rendered.

`"bevel"`: A join with a squared-off end which is drawn beyond the endpoint of the line at a distance of one-half of the lines width.

`"round"`: A join with a rounded end which is drawn beyond the endpoint of the line at a radius of one-half of the lines width and centered on the endpoint of the line.

`"miter"`: A join with a sharp, angled corner which is drawn with the outer sides beyond the endpoint of the path until they meet.

Default `"round"`.
offset

The line's offset. A positive value offsets the line to the right, relative to the direction of the line. A negative value offsets to the left. Default 0.

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.

strokeColor

Specifies the color of the line. Default "#1E90FF".

strokeDashArray

Specifies the lengths of the alternating dashes and gaps that form the dash pattern. Numbers must be equal or greater than 0. The lengths are scaled by the strokeWidth. To convert a dash length to pixels, multiply the length by the current stroke width.

strokeGradient

Defines a gradient with which to color the lines. Requires the DataSource lineMetrics option to be set to true. Disabled if strokeDashArray is set.

strokeOpacity

A number between 0 and 1 that indicates the opacity at which the line will be drawn. Default 1.

strokeWidth

The width of the line in pixels. Must be a value greater or equal to 0. Default 2.

translate

The amount of offset in pixels to render the line relative to where it would render normally. Negative values indicate left and up. Default: [0,0]

translateAnchor

Specifies the frame of reference for translate.

`"map"`: Lines are translated relative to the map.

`"viewport"`: Lines are translated relative to the viewport

Default: `"map"`

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

blur

The amount of blur to apply to the line in pixels. Default 0.

blur?: number | DataDrivenPropertyValueSpecification<number>

Property Value

number | DataDrivenPropertyValueSpecification<number>

lineCap

Specifies how the ends of the lines are rendered.

`"butt"`: A cap with a squared-off end which is drawn to the exact endpoint of the line.

`"round"`: A cap with a rounded end which is drawn beyond the endpoint of the line at a radius of one-half of the lines width and centered on the endpoint of the line.

`"square"`: A cap with a squared-off end which is drawn beyond the endpoint of the line at a distance of one-half of the line width.

Default `"round"`.
lineCap?: "butt" | "round" | "square"

Property Value

"butt" | "round" | "square"

lineJoin

Specifies how the joints in the lines are rendered.

`"bevel"`: A join with a squared-off end which is drawn beyond the endpoint of the line at a distance of one-half of the lines width.

`"round"`: A join with a rounded end which is drawn beyond the endpoint of the line at a radius of one-half of the lines width and centered on the endpoint of the line.

`"miter"`: A join with a sharp, angled corner which is drawn with the outer sides beyond the endpoint of the path until they meet.

Default `"round"`.
lineJoin?: "bevel" | "round" | "miter"

Property Value

"bevel" | "round" | "miter"

offset

The line's offset. A positive value offsets the line to the right, relative to the direction of the line. A negative value offsets to the left. Default 0.

offset?: 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

strokeColor

Specifies the color of the line. Default "#1E90FF".

strokeColor?: string | DataDrivenPropertyValueSpecification<string>

Property Value

string | DataDrivenPropertyValueSpecification<string>

strokeDashArray

Specifies the lengths of the alternating dashes and gaps that form the dash pattern. Numbers must be equal or greater than 0. The lengths are scaled by the strokeWidth. To convert a dash length to pixels, multiply the length by the current stroke width.

strokeDashArray?: number[]

Property Value

number[]

strokeGradient

Defines a gradient with which to color the lines. Requires the DataSource lineMetrics option to be set to true. Disabled if strokeDashArray is set.

strokeGradient?: Expression

Property Value

strokeOpacity

A number between 0 and 1 that indicates the opacity at which the line will be drawn. Default 1.

strokeOpacity?: number | DataDrivenPropertyValueSpecification<number>

Property Value

number | DataDrivenPropertyValueSpecification<number>

strokeWidth

The width of the line in pixels. Must be a value greater or equal to 0. Default 2.

strokeWidth?: number | DataDrivenPropertyValueSpecification<number>

Property Value

number | DataDrivenPropertyValueSpecification<number>

translate

The amount of offset in pixels to render the line relative to where it would render normally. Negative values indicate left and up. Default: [0,0]

translate?: Pixel

Property Value

translateAnchor

Specifies the frame of reference for translate.

`"map"`: Lines are translated relative to the map.

`"viewport"`: Lines are translated relative to the viewport

Default: `"map"`
translateAnchor?: "map" | "viewport"

Property Value

"map" | "viewport"

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