MvtStyle

fun interface MvtStyle

Decides how each MVT feature should be drawn: for polygons and lines, what ShapeAttributes to apply; null skips the feature entirely.

Two implementation styles ship in the package: hand-coded (DefaultMvtStyle, OpenTopoMapMvtStyle) and rule-based with filter/zoom support (MvtRuleBasedStyle, built by the mvtStyle DSL).

Implementations should be pure and stateless — MvtVectorLayer resolves the style once per feature during background tile assembly, off the render thread.

Inheritors

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

Solid base under every fill — the Mapbox background layer. Fills gaps MVT has no polygon for (bare rock, street interiors, highway corridors); null (default) shows whatever is beneath the layer. See Z_BACKGROUND.

Functions

Link copied to clipboard
abstract fun styleFor(layerName: String, geometryType: MvtGeometryType, properties: Map<String, Any?>): ShapeAttributes?

Resolve attributes for one feature. layerName is the MVT layer (e.g. water, transportation, building); geometryType gates polygon-vs-line attribute choice. properties is the inflated feature property map.

Link copied to clipboard
open fun zOrderFor(layerName: String, geometryType: MvtGeometryType, properties: Map<String, Any?>): Int

Optional paint order within a tile. Features with smaller zOrderFor paint first, features with larger values paint over them. Default 0 — every feature shares the same z-layer, and the order falls through to MVT-server-determined layer iteration order (good enough for OpenMapTiles-schema servers that already order water → landuse → roads → buildings sensibly).