Mvt Geometry
Convert the raw MVT command stream of an MvtFeature into lat/lon geometry for a slippy tile at (z, x, y) with the given extent (tile-coordinate resolution; conventionally 4096).
Command stream layout (vector-tile-spec §4.3.2): CommandInteger = (id & 0x7) | (count << 3) id 1 = MoveTo (count×{dx, dy}) id 2 = LineTo (count×{dx, dy}) id 7 = ClosePath (no parameters) Parameter values are zigzag-encoded varints; MvtDecoder left them as raw uint32 bits.
Per geometry type: POINT — one MoveTo with N≥1 parameter pairs, each an independent point. LINESTRING — repeated MoveTo(1) + LineTo(K); each MoveTo starts a new linestring. POLYGON — repeated MoveTo(1) + LineTo(K) + ClosePath; signed area in tile-space discriminates exterior (positive) from interior (negative) rings. Holes follow their enclosing exterior in the stream.
The cursor starts at (0, 0) and accumulates deltas across all commands; MoveTo updates it just like LineTo (the spec is explicit on this).
All entry points are stateless — concurrent calls from parallel tile-fetch coroutines are safe.
Types
Result of labelAnchorForLine: where to place a line label and how to orient it. bearingDeg is the local tangent bearing in degrees (0 = north, 90 = east), suitable for earth.worldwind.shape.Label.rotation with rotationMode = RELATIVE_TO_GLOBE.
Rings as flat interleaved [lon°, lat°, …] degree arrays — avoids a Position object per vertex (thousands per dense tile) and feeds earcut / MvtBatchedPolygonTile directly.
Per-tile reused scratch for the decode hot path. One instance per tile (decoded on a single worker thread), threaded through the decode entry points so the inner loops allocate nothing per feature or per ring. NOT thread-safe — one instance per concurrent tile assembly.
Functions
Inflate a LINESTRING feature into polylines (each MoveTo starts a new one), each a flat interleaved [lon°, lat°, …] degree array — no per-vertex Position; altitude dropped.
Inflate a POINT feature's geometry into one Position per point. Empty on malformed input.
Inflate a POLYGON feature into a list of (outerRing, holes) pairs. Exterior rings have positive signed area in tile-space coordinates (where Y grows downward); negative-area rings are holes attached to the most recently emitted exterior ring.
Find the midpoint of line (by cumulative chord length) and the bearing of the segment containing it. Used by MvtVectorLayer to place single labels along LINESTRING features under MvtStyleRule.LabelPlacement.LINE.