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(VectorSourceDescriptor(id = "roads", url = roadTileUrlTemplate))
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.equals(Expression.get("class"), "motorway"),
),
beforeID = null,
)
// Then mask a weather layer against it. The mask is declared on the weather layer's
// configuration, not as an addWeatherLayer parameter:
val temperature = WeatherService.Temperatures(controller.service)
temperature.layer.layerMask = LayerMaskSpec(
layers = listOf(LayerMaskLayerConfig(id = "road-motorway")),
)
controller.addWeatherLayer(temperature)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).
JS-style mask shorthand (mask: { layerIds: [...] }). Resolved to stencilLayerMask when stencilLayerMask is unset. Apple's maskConfiguration maps here / to stencilLayerMask.
Single mask layer id shorthand. Lowest precedence among mask fields.
List of mask layer ids (JS mask.layerIds). Lower precedence than layerMask.
Highest map zoom at which this layer draws. Not active in 1.8.0; see LayerDescriptor.maxZoom.
Lowest map zoom at which this layer draws. Not active in 1.8.0; see LayerDescriptor.minZoom.
Line stroke styling serialized to Mapbox line-* paint properties.
Whether to preload low-resolution fallback tiles. Not active in 1.8.0; see LayerDescriptor.preloadLowQuality.
MVT layer name, or null for GeoJSON-only usage.
Advanced custom stencil mask. Takes precedence over layerMask / maskLayerIds / maskLayerId.
When true, skip registering a visible Mapbox line layer; still drive stencil mesh build. See VectorLayerDescriptor.stencilOnly.
Optional per-layer timing (Apple timing). When non-null, com.xweather.mapsgl.map.MapController.addLayer copies these fields onto the created com.xweather.mapsgl.layers.tile.TileLayer.timing. Null keeps the layer's existing defaults (time-series sources may still enable interval mode).
When true, eligible fill/line/circle/symbol layers draw via MapsGL GLES instead of Mapbox style layers. MVT sources use com.xweather.mapsgl.renderers.VectorFillLayerRenderer / com.xweather.mapsgl.renderers.VectorLineLayerRenderer / etc. GeoJSON fill, line, circle, symbol, and heatmap layers also support GLES when this flag is set.