Line Layer Descriptor
Descriptor for a Mapbox line layer: line strings (and polygon rings when applicable) stroked from a vector or GeoJSON source.
Setup matches other VectorLayerDescriptor types: add the source with com.xweather.mapsgl.map.MapController.addSource, then register this descriptor with com.xweather.mapsgl.map.MapController.addLayer. The runtime implementation is a com.xweather.mapsgl.layers.tile.VectorTileLayer backed by Mapbox’s native line style layer.
Sources
Vector tiles: set sourceLayer to the MVT layer name that contains line geometry.
GeoJSON: set sourceLayer to
nullwhen the whole feature collection should be used.
Paint (paint) is a com.xweather.mapsgl.style.LineLayerPaint wrapping com.xweather.mapsgl.style.StrokePaint; it maps to Mapbox line-color, line-opacity, line-width, line-join, line-cap, and line-miter-limit. Join, cap, and miter limit are also honored when this layer is used as a GLES stencil mask source (road ribbons, custom mask pipelines).
Stencil-only lines: when stencilOnly is true, MapsGL still fetches tiles and builds stencil geometry from this layer’s features, but does not add a visible Mapbox line layer. Use that for mask-only line sources (for example motorways referenced from LayerMaskSpec on a weather layer), analogous to JS layers that exist primarily for mask.layers.
Example (visible road line, then reference its id from a weather layer’s LayerMaskSpec):
controller.addSource("roads", vectorSourceDescriptor)
controller.addLayer(
LineLayerDescriptor(
id = "road-motorway",
source = "roads",
sourceLayer = "transportation",
paint = LineLayerPaint(stroke = StrokePaint().apply {
thickness = StyleValue.Constant(5.0)
lineJoin = StyleValue.Constant(LineJoin.MITER)
lineCap = StyleValue.Constant(LineCap.ROUND)
}),
filter = Expression.eq(Expression.get("class"), Expression.literal("motorway"))
)
)
// controller.addWeatherLayer(..., layerMask = LayerMaskSpec(layers = listOf(LayerMaskLayerConfig(id = "road-motorway"))))See also
Constructors
Properties
Optional Mapbox filter expression; narrows which features draw and which contribute to masks.
Unique layer id within the map controller (referenced by LayerMaskSpec / StencilLayerMaskSpec when used as a mask).
Line stroke styling serialized to Mapbox line-* paint properties.
MVT layer name, or null for GeoJSON-only usage.
When true, skip registering a visible Mapbox line layer; still drive stencil mesh build. See VectorLayerDescriptor.stencilOnly.