LineLayer

inline fun LineLayer(id: String, source: Source, sourceLayer: String = "", minZoom: Float = 0.0f, maxZoom: Float = 24.0f, filter: Expression<Boolean> = nil(), visible: Boolean = true, sortKey: Expression<Number> = nil(), translate: Expression<Point> = point(0, 0), translateAnchor: Expression<String> = const(TranslateAnchor.Map), opacity: Expression<Number> = const(1), color: Expression<Color> = const(Color.Black), dasharray: Expression<List<Number>> = nil(), pattern: Expression<TResolvedImage> = nil(), gradient: Expression<Color> = nil(), blur: Expression<Number> = const(0), width: Expression<Number> = const(1), gapWidth: Expression<Number> = const(0), offset: Expression<Number> = const(0), cap: Expression<String> = const(StrokeCap.Butt), join: Expression<String> = const(StrokeJoin.Miter), miterLimit: Expression<Number> = const(2), roundLimit: Expression<Number> = const(1.05), noinline onClick: (features: List<Feature>) -> Unit? = null, noinline onLongClick: (features: List<Feature>) -> Unit? = null)

A line layer draws polylines and polygons from the sourceLayer in the given source in the given style as a series of lines and outlines, respectively. If nothing else is specified, these will be black lines of 1 dp width.

Parameters

id

Unique layer name.

source

Vector data source for this layer.

sourceLayer

Layer to use from the given vector tile source.

minZoom

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].

maxZoom

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].

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.

visible

Whether the layer should be displayed.

sortKey

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.

translate

The geometry's offset relative to the translateAnchor. Negative numbers indicate left and up, respectively.

translateAnchor

Frame of reference for offsetting geometry, see TranslateAnchor.

Ignored if translate is not set.

opacity

Lines opacity. A value in range [0..1].

color

Lines color.

Ignored if pattern is specified.

dasharray

Specifies the lengths of the alternating dashes and gaps that form the dash pattern. The lengths are later scaled by the line width. To convert a dash length to pixels, multiply the length by the current line width. Note that GeoJSON sources with lineMetrics = true specified won't render dashed lines to the expected scale. Also note that zoom-dependent expressions will be evaluated only at integer zoom levels. Ignored if pattern is specified.

pattern

Image to use for drawing image lines. For seamless patterns, image width must be a factor of two (2, 4, 8, ..., 512). Note that zoom-dependent expressions will be evaluated only at integer zoom levels.

gradient

Defines a gradient with which to color a line feature. Can only be used with GeoJSON sources that specify lineMetrics = true.

Ignored if pattern or dasharray is specified.

blur

Blur applied to the lines, in dp. A value in range 0..infinity.

width

Thickness of the lines' stroke in dp. A value in range [0..infinity).

gapWidth

A value in range [0..infinity). If not 0, instead of one, two lines, each left and right of each line's actual path are drawn, with the given gap in dp in-between them.

offset

The lines' offset. For linear features, a positive value offsets the line to the right, relative to the direction of the line, and a negative value to the left. For polygon features, a positive value results in an inset, and a negative value results in an outset.

cap

Display of line endings. See StrokeCap.

join

Display of joined lines. See StrokeJoin.

miterLimit

Limit at which to automatically convert to bevel join for sharp angles when join is StrokeJoin.Miter.

roundLimit

Limit at which to automatically convert to miter join for sharp angles when join is StrokeJoin.Round.