OpenTopoMapMvtStyle

Hand-coded MvtStyle that approximates the palette of OpenTopoMap for MVT sources following the OpenMapTiles v3 schema (Versatiles, Maptiler, self-hosted OpenMapTiles). Reference implementation for the imperative-DSL approach — for the same look with zoom-interpolation and labels, use the rule-based OpenTopoMapRules instead.

Reproduces the OpenTopoMap visual identity: cream background, muted-green landcover, light-blue water, brown tracks, single-tone roads by class, gray-beige building shells.

Not modelled here: road casings (the white/yellow stripe under the colored road fill). WorldWind's earth.worldwind.shape.Path is single-colored and per-feature back-to-front sub-draws don't have a stable z-order within a tile. Roads render with the fill color only — close enough at typical zoom levels.

Use as the MvtVectorLayer.style argument:

val layer = MvtVectorLayer(
source = UrlTemplateMvtTileSource("https://tiles.versatiles.org/tiles/osm/{z}/{x}/{y}"),
style = OpenTopoMapMvtStyle,
)

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Cream page color, exposed via backgroundColor so the layer paints a full-tile fill under every feature automatically. Also usable as the WorldWind viewport clear color when this style overlays no imagery, so partial edge tiles blend into the same page tone.

Link copied to clipboard
open override val backgroundColor: Color

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.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
open override 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 override 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).