Taos API Reference
    Preparing search index...

    Module geo

    The geospatial streaming stack: an f64 floating-origin frame (GeoFrame), a multi-tileset scene orchestrator (GeoScene) and its engine integration (GeoFeature), quantized-mesh terrain (TerrainTileset) and 3D-Tiles (Tileset3D) streaming, data sources (Cesium ion, Google, MapTiler), imagery, water, and the geodesy/decoding helpers underneath.

    Imported via the taos/geo subpath rather than the top-level taos barrel, e.g. import { GeoScene, GeoFrame } from 'taos/geo';.

    The Worker entry points (tile_decode_worker.ts, terrain_bake_worker.ts) are intentionally NOT re-exported here — they run in a worker context and would execute their top-level code if pulled into the main thread.

    Enumerations - Vector & GeoJSON

    MvtGeomType

    MVT geometry type (Feature.type).

    Classes - Core

    GeoClipping
    GeoFrame

    The local tangent frame the whole scene is rendered in. originEcef is the ECEF anchor; worldFromEcef rotates+translates ECEF into the engine's Y-up world (East→+X, Up→+Y, North→−Z) so points near the origin are f32-safe. ecefFromWorldRot is the inverse rotation (origin-relative), used to map a world-space camera position back to ECEF for screen-space-error distances.

    GeoFeature
    GeoScene

    Classes - Components

    GeoWorld

    A streamed geospatial world: terrain + imagery (+ optional buildings) anchored at a longitude/latitude. Renders in both edit and play so the world is visible while authoring.

    GeoJson

    A GeoJSON vector overlay: bakes a .geojson URL into meshes and renders them, aligned to the active GeoWorld's frame (or its own lon/lat if there is none). Polygons extrude to extrudeHeight when positive.

    Classes - Tilesets

    Subtree

    Parsed availability bitstreams of one subtree file. Construct it from the subtree JSON plus the resolved bytes of each buffer it declares — buffers[i] is the internal binary chunk for a buffer with no uri, or the fetched bytes for an external one (see parseSubtree for the internal-only convenience and parseSubtreeHeader + the traversal for the external path).

    EllipsoidalOccluder
    TileCache
    TileContent

    Loaded, rebased tile content. Owns the static GltfStaticModel (its non-skinned meshes + textures), all released on cache eviction.

    PointCloudGpu

    A baked, origin-relative GPU point buffer for a .pnts tile: interleaved position(float32×3) + color(unorm8×4) (16-byte stride), drawn point-by-point.

    Cesium3DTileStyle

    A parsed 3D Tiles style. Construct from the JSON form, then call show / color per feature. Mirrors CesiumJS Cesium3DTileStyle.

    TileDecodePool
    Tileset3D

    Classes - Terrain

    MapTilerTerrainSource

    A GeoDataSource for MapTiler quantized-mesh terrain via the direct API.

    RasterDemSource

    A raster-DEM provider (Seam A). Tile content is fetched through HttpDataSource (so it shares the persistent Cache-Storage and the data-source log); kind is 'TERRAIN' since it streams elevation, but it is consumed by RasterDemTileset, not the quantized-mesh TerrainTileset.

    RasterDemTileset
    TerrainHeightSampler

    CPU-side terrain elevation lookup for one decoded tile, retained so other content (e.g. buildings) can be clamped to the ground. Keeps the quantized surface u/v/height arrays + triangle indices (the heights are otherwise discarded once baked into the mesh) and buckets the triangles into a uniform SAMPLER_GRID² grid over u/v, so heightAt is ~O(1) per query.

    TileWaterMask

    Land/water lookup for one tile, from the quantized-mesh watermask extension. A whole-tile flag (size === 1) answers the same for the entire rectangle; a 256×256 grid (size === 256) is sampled at the query's u/v fraction. Rows run south→north, columns west→east (matching the tile's u/v), and a byte ≥ 128 counts as water (the coastline ramp straddles 128). Retained on TerrainContent so TerrainTileset.waterAt can answer per point.

    TerrainContent

    Loaded terrain tile: an engine mesh in world space + its material.

    TerrainTileset
    TerrainBakePool

    Classes - Data Sources

    IonAsset

    Resolved ion endpoint plus the per-asset token / attribution to stream it.

    HttpDataSource

    Base for HTTP-backed providers: shared JSON / binary fetch with persistent caching. Subclasses supply rootUrl, attributions, kind, and — if the provider authorizes per request rather than via a URL key — override authHeaders.

    UrlTilesetSource

    A 3D-Tiles source from a plain tileset.json URL — no ion/Google auth, so it loads any public tileset (the CesiumGS/3d-tiles-samples, your own hosting, etc.). The base HttpDataSource supplies the persistent-cached JSON/binary fetch; tile URIs resolve relative to rootUrl exactly like an ion 3DTILES source.

    DataSourceLog

    Optional instrumentation of data-source loads, for diagnosing what's hitting the network vs. the persistent cache. DISABLED by default: while enabled is false every record call early-returns, so the only cost on the load path is a single boolean test and nothing is retained.

    GoogleTilesSource

    A GeoDataSource for Google Photorealistic 3D Tiles via the direct API.

    Classes - Vector & GeoJSON

    GeoLineFeature
    GeoJsonLayer
    VectorTileSource

    A vector-tile provider (Seam A). MVT bytes are fetched through HttpDataSource (so they share the persistent cache + data-source log).

    VectorTileContent

    A baked vector-tile's drawables (here, one merged building mesh) + its point labels. Structurally matches the drawable contract GeoScene renders (drawables + bakeOriginEcef + lodLevel).

    VectorTileset
    GeoWaterFeature
    GeoWireframeFeature

    Classes - Geo

    StreetViewPanel

    Classes - Time-Dynamic

    TimeInterval

    A half-open-ish time interval (inclusive of both ends for contains).

    ConstantPositionProperty

    A position that never changes.

    SampledPositionProperty

    A position defined by timestamped ECEF samples, interpolated between them — the analog of CesiumJS SampledPositionProperty. Samples are kept sorted; getValueEcef clamps to the first/last sample outside the sampled range (so a tracked object holds at the ends rather than vanishing). Linear and Lagrange (configurable degree) interpolation.

    Clock

    A simulation clock — the analog of CesiumJS Clock. Advances currentTime by multiplier × dt each tick, honoring clockRange at the bounds.

    Classes - Other

    StyleExpression

    A single parsed show / color / define expression.

    Interfaces - Core

    AnchorPlacement
    ClipPlaneDef

    A clipping plane anchored on the ellipsoid. Content on the side the normalEnu points away from is hidden (matching Cesium: the normal points toward what is kept). The normal is given in the local East–North–Up frame at the anchor, so e.g. { u: 1 } keeps everything above the anchor height (a horizontal floor cut) and { e: 1 } keeps everything east of the anchor (a vertical wall facing west).

    ClipPolygonDef

    A clipping polygon footprint (a single ring of >= 3 geographic positions).

    Vec3d

    A point in any of our frames (plain f64 numbers, never f32).

    FrameSnapshot

    A frozen copy of a GeoFrame's placement — its ECEF origin plus the ENU tangent basis — enough to map that frame's world coordinates back to ECEF. Stamped on baked geometry so a later, REORIENTED frame can place it with the correct rigid transform (continuous reorientation / RTC) instead of needing the geometry re-baked.

    Rectangle

    A geographic rectangle in radians (west/south/east/north).

    TilingScheme

    A quadtree tiling scheme over the globe: how many tiles tile the world at each level, and the geographic rectangle of any tile. Quantized-mesh terrain endpoints use either the geographic (EPSG:4326, the default — 2 root tiles wide, square 2:1 tiles) or the Web Mercator (EPSG:3857 — a single square root tile) scheme; the traversal reads which one from layer.json's projection field. Abstracting it keeps TerrainTileset from hardcoding the geographic root count / rectangle.

    GeoFeatureOptions
    GeoTilesetOptions

    Options for a 3D Tiles tileset added to a GeoScene.

    GeoVectorOptions

    Options for a vector-tile tileset added to a GeoScene.

    GeoTerrainOptions

    Options for a terrain tileset added to a GeoScene.

    GeoUpdateParams

    Per-frame camera/selection inputs for GeoScene.update.

    GeoFrameResult

    What GeoScene.update produced this frame. All arrays are owned and reused (pooled) across frames — copy them if you need to retain past the next update.

    GeoSceneOptions

    Cache-budget settings shared by every tileset's TileCache.

    GeoAttachOptions

    Options for GeoScene.attach: everything GeoFeatureOptions needs minus scene (it's the scene attach is called on), plus optional one-call floating-origin wiring.

    Interfaces - Tilesets

    ImplicitCoord

    Implicit coordinates relative to the implicit root (z unused for quadtree).

    ImplicitContext

    Per-implicit-tileset configuration, built once from the implicitTiling tile and shared by every tile generated under it.

    CacheValue

    Anything the cache can hold: it must report its cost and release GPU memory.

    CacheStats
    TileDrawable

    One drawable primitive of a tile, with its rebased engine transforms.

    LoadContentOptions
    SelectParams
    RenderTile

    One tile to draw this frame: its loaded content and the cross-fade alpha to render it with (1 = fully opaque; < 1 = screen-door dithered over the coarser tile below).

    Plane
    TilesetStats

    Interfaces - Terrain

    QuantizedMeshHeader
    QuantizedMeshEdges

    Boundary vertex index lists, in the order quantized-mesh stores them.

    MetadataAvailableRange

    A descendant-availability range in the metadata extension (TMS tile coords).

    QuantizedMeshMetadata

    Decoded metadata extension JSON. available[offset] lists the tile ranges available at level tileLevel + offset + 1 — lets refinement go deeper than the layer.json available array enumerates.

    QuantizedMeshTile
    QuantizedMeshWaterMask

    The quantized-mesh watermask extension (id 2): per the spec, either a single byte covering the whole tile, or a 256×256 row-major grid — 255 = water, 0 = land (intermediate values appear along coastlines). Rows run south → north and columns west → east, the same orientation as the tile's u/v (so row index maps to the v fraction, column to the u fraction).

    RasterDemOptions

    Options for a RasterDemSource.

    TerrainStats
    FrameTransform

    The rigid floating-origin frame as plain transferable data, so the bake can run in a worker. worldFromEcef is the f64 column-major world←ECEF matrix; the basis vectors rotate ECEF directions (normals) into world space. Mirrors the relevant fields of GeoFrame.

    BakedTerrain

    The result of baking — the three arrays the GPU terrain mesh is built from.

    BakeJob

    The decoded-tile inputs a bake needs, bundled for one TerrainBakePool.bake.

    UpsampleSource

    The minimal parent-surface data upsampleQuantizedMesh reads: quantized u/v/height plus the surface triangle indices and the parent's height range (to de-quantize heights into meters before re-quantizing to the child's own range). These are exactly the arrays a TerrainHeightSampler already retains.

    Interfaces - Data Sources

    Attribution

    A line of attribution text (HTML) that must be displayed while a source is on screen. collapsible marks long provider lists that a UI may fold away.

    GeoDataSource

    The minimal surface Tileset3D / TerrainTileset need from a provider.

    DataSourceLogEntry

    One retained load event — a network download or a persistent-cache hit.

    DataSourceLogView

    Interfaces - Imagery

    MercTile
    ImageryProvider

    A Web Mercator (EPSG:3857) XYZ raster imagery source for draping over terrain.

    XyzImageryOptions

    Options for xyzImagery, a generic {z}/{x}/{y} slippy-map source.

    MercTileBlock

    A rectangular block of Web Mercator tiles at one zoom, draped as a single composited texture. (x0,y0) is the north-west tile; the block is cols × rows tiles, each 256².

    ImageryAdjust

    Per-layer color / opacity adjustments, applied at composite time. Every field defaults to a no-op (alpha/brightness/contrast/gamma/saturation = 1, hue = 0).

    ImageryLayer

    One provider in a stack + its adjustments.

    ImageryStack

    An ordered imagery stack (layer 0 is the base; later layers composite on top).

    Interfaces - Vector & GeoJSON

    GeoLineDraw

    One batch of line segments to draw: the instance buffer (see buildLineSegments), the segment count, and the world model matrix (origin-shift), like a point-cloud draw.

    GeoPointPrimitive

    A point primitive (one of a Point / each part of a MultiPoint).

    GeoLinePrimitive

    A polyline primitive (a LineString / each part of a MultiLineString).

    GeoPolygonPrimitive

    A polygon primitive (a Polygon / each part of a MultiPolygon). rings[0] is the exterior ring; any further rings are holes. Rings keep their GeoJSON winding (exterior CCW, holes CW per the spec) but the builders are orientation-agnostic.

    ParsedGeoJson

    The flat, primitive-typed result of parseGeoJson — three lists ready for the builders, with Multi* parts already expanded.

    PolygonBakeOptions
    LineBakeOptions
    LineSegmentOptions
    GeoPointAnchor

    A point feature's stable anchor for the label / billboard feature: an ECEF position (so it survives floating-origin reanchors), plus its properties / id.

    PointBakeOptions
    PolygonAnchorOptions
    GeoJsonLayerStyle

    Per-geometry-kind styling for a baked layer. A heightAt set here (or on each sub-option) drapes geometry onto streamed terrain.

    GeoJsonDrawMesh

    One baked, drawable mesh + the material to draw it with.

    GeoJsonPick

    A successful GeoJsonLayer.pick: the feature id + its properties + the world hit point.

    GeoJsonLabelOptions

    Options for geoJsonPointLabels.

    FillLayer

    A draped polygon layer.

    LineLayer

    A draped line layer (rendered as a metric-width ribbon).

    ExtrusionLayer

    An extruded (building) layer.

    SymbolLayer

    A label (symbol) layer — point features whose textField property becomes a map label.

    VectorStyle

    The vector layers grouped by how they become 3D geometry (+ labels).

    ParsedStyle

    Result of parsing a full MapLibre style document.

    VectorFeature

    A decoded feature: its geometry as rings of tile-local points + decoded properties.

    VectorLayer

    A decoded layer.

    VectorTileOptions

    Options for a VectorTileSource. Provide template for a direct {z}/{x}/{y} URL, or tilejson to resolve the template (+ max zoom) from a TileJSON document at init — many hosts (e.g. OpenFreeMap) put a rotating version segment in the real tile path, so the bare path is a stub; the TileJSON is the source of truth.

    VectorTileClamp

    Render-time terrain-clamp anchor for a baked tile: the tile is baked once against the terrain height at build time, then GeoScene nudges its whole draw vertically each frame by the delta between the live terrain height under its center and buildHeight — so it conforms continuously as terrain refines, instead of re-baking.

    VectorDebugOptions

    Debug isolation knobs (set from geo_osm_buildings's ?only=/?onlyId= for diagnosing building z-fighting). Off in normal use.

    GeoWaterDraw

    One water tile to draw: its conformed surface mesh (tile-local UVs in slot 2), the world model matrix (origin-shift), and the per-tile mask texture view.

    GeoWaterSettings

    Live look controls, read each frame.

    Interfaces - Geo

    StreetViewOptions

    Interfaces - Time-Dynamic

    CzmlPoint
    CzmlPath
    CzmlLabel
    CzmlModel
    CzmlBillboard
    CzmlEntity

    One parsed CZML entity.

    CzmlDocument

    A parsed CZML document.

    PositionProperty

    A position that may vary with time, evaluated in ECEF.

    ClockOptions

    Options for Clock.

    Interfaces - Other

    StreetViewPov

    A heading/pitch point-of-view in degrees (Google's convention: heading 0 = north, CW).

    StyleColor

    An RGBA color in 0–1 (the result type of color() / rgb() expressions).

    TileStyleJson

    The JSON form of a 3D Tiles style.

    Type Aliases - Core

    Mat4d

    Column-major 4×4 matrix in f64, same layout as the engine's Mat4.

    Type Aliases - Tilesets

    SubdivisionScheme
    Loader

    Loads a value; receives an AbortSignal so a stale request can cancel its fetch.

    Type Aliases - Terrain

    DemEncoding

    How a DEM tile's RGB encodes meters of elevation.

    Type Aliases - Data Sources

    DataSourceKind

    What a source streams, so a caller can pick the right tileset class without knowing the provider: a 3D Tiles tree, quantized-mesh terrain, or raster imagery.

    Type Aliases - Vector & GeoJSON

    GeoPosition

    A GeoJSON position: [lon, lat] or [lon, lat, altitude] (degrees / meters). Altitude defaults to 0 when absent.

    GeoProperties

    A feature's free-form properties (GeoJSON allows any JSON; null when the feature has none).

    HeightSampler

    A terrain height sampler: meters above the ellipsoid at a lon/lat (degrees), or null when no streamed terrain covers the point (the caller falls back to ellipsoid height).

    Type Aliases - Time-Dynamic

    CzmlColor

    An RGBA color in 0–1.

    InterpolationAlgorithm

    Interpolation algorithm for SampledPositionProperty.

    ClockRange

    How the Clock treats reaching its stopTime.

    Type Aliases - Other

    GeoImagery

    Imagery preset choices exposed by GeoWorld.

    StyleProperties

    A feature's properties (the getAll bag of a FeatureTable, or any plain object).

    Variables - Core

    WGS84_A

    WGS84 ellipsoid semi-major axis (meters).

    WGS84_B

    WGS84 semi-minor axis (meters).

    DEG2RAD
    RAD2DEG
    GEOGRAPHIC_TILING_SCHEME

    Cesium's default geographic scheme (EPSG:4326): 2 root tiles in longitude, 1 in latitude; each tile spans equal lon/lat steps.

    WEB_MERCATOR_MAX_LATITUDE

    Maximum geodetic latitude (radians) Web Mercator can represent — the square cutoff at ±~85.05°, where the projection's normalized Y reaches ±π.

    WEB_MERCATOR_TILING_SCHEME

    Web Mercator scheme (EPSG:3857): a SINGLE square root tile covering the world in both axes (latitude clamped to ±WEB_MERCATOR_MAX_LATITUDE), quartered per level. Tile rows are equal steps in the Mercator Y, so their geographic latitude bands narrow toward the poles (unprojected here via the inverse Gudermannian).

    Variables - Tilesets

    DEFAULT_MAX_SSE

    Default target screen-space error (pixels) for a tileset — CesiumJS's default maximumScreenSpaceError. Lower = sharper / more tiles. Overridable per instance via Tileset3D.maxSSE / TerrainTileset.maxSSE.

    DEFAULT_MAX_RENDER_DISTANCE

    Default render-distance cap (world meters) for a 3D-Tiles set — see Tileset3D.maxRenderDistance. Buildings beyond this are skipped; set the tileset's maxRenderDistance = Infinity to draw to the horizon.

    PRELOAD_PENALTY

    Priority offset added to a preload-ring (off-screen) load so it always sorts AFTER every in-view load in the cache's priority dispatch — warming the ring must never delay a visible tile. Larger than any real camera-to-tile distance (≫ a planet diameter), so ring loads only start once the on-screen frontier is busy.

    PRELOAD_RING_BUDGET

    Max selection-leaf tiles a single frame's preload-ring walk will request, a safety bound on the warm traversal (the cache's concurrency cap already bounds the loads that actually start).

    Variables - Terrain

    QM_MAX

    Largest u/v/height quantization value (15-bit).

    AWS_TERRARIUM

    AWS Terrain Tiles (Mapzen Terrarium encoding) — global, no API key.

    LEVEL_ZERO_ERROR

    Heightmap geometric error at level 0 (meters), per Cesium's estimate for the geographic scheme: a · 2π · quality / (tileWidth · rootTilesX) with quality 0.25, tileWidth 65, rootTilesX 2. Halved each level.

    STRIDE_FLOATS

    Interleaved vertex stride in floats — must equal VERTEX_STRIDE / 4 from mesh.js (48 bytes / 4 = 12 floats: pos3, normal3, uv2, tangent4). Defined here (not imported) to keep this module free of the GPU-side mesh.js; the caller asserts the two agree.

    Variables - Data Sources

    ION_ASSETS

    Well-known Cesium ion asset IDs used by the sample's dataset switcher.

    dataSourceLog

    Shared, optional data-source load log — off by default (see DataSourceLog).

    Variables - Imagery

    ESRI_WORLD_IMAGERY

    Esri World Imagery (the default drape): global aerial, no key for light/dev use. Note the non-standard /{z}/{row}/{col} = /{z}/{y}/{x} path order.

    OSM_RASTER

    Standard OpenStreetMap raster tiles. NB the OSMF tile servers carry a usage policy that forbids heavy/bulk use — fine for dev, but self-host or use Carto/Stadia/MapTiler for anything shipping.

    CARTO_LIGHT

    CARTO Positron ("light") basemap — OSM-derived, clean cartography, generous free tier.

    CARTO_DARK

    CARTO Dark Matter basemap — OSM-derived dark cartography.

    CARTO_LIGHT_LABELS

    CARTO Positron LABELS-ONLY — place/road labels on a TRANSPARENT background, for compositing as an OVERLAY layer over aerial imagery (the classic "satellite + labels" stack).

    CARTO_DARK_LABELS

    CARTO Dark Matter LABELS-ONLY (transparent), for an overlay over dark / night imagery.

    CARTO_LIGHT_RETINA

    CARTO Positron at 2× (512 px) — sharper draping on high-DPI displays (4× the texels per tile).

    STADIA_ALIDADE_SMOOTH

    Stadia Alidade Smooth — light, low-contrast OSM basemap (keyless from localhost).

    STADIA_ALIDADE_DARK

    Stadia Alidade Smooth Dark.

    IMAGERY_ATTRIBUTION

    Attribution string that must be shown when the default Esri World Imagery is displayed. (Per-provider attribution now lives on ImageryProvider.attribution.)

    ESRI_STACK

    Convenience: the default single-layer stack (Esri aerial), for callers that want the stack API.

    Variables - Vector & GeoJSON

    DEFAULT_VECTOR_STYLE

    The built-in style used when a VectorTileset is given no MapLibre style — matches the original hand-coded buildings + roads + water/greenery look (OpenMapTiles schema).

    OPENFREEMAP_VECTOR

    OpenFreeMap — free, key-less OpenMapTiles-schema vector tiles (https://openfreemap.org). The real tile path carries a rotating version segment, so resolve it from the TileJSON.

    Variables - Other

    MAX_CLIP_PLANES

    Max clipping planes (matches the planes array in geometry.wgsl).

    MAX_CLIP_POLY_VERTS

    Max clipping-polygon vertices (matches the poly array in geometry.wgsl).

    CLIP_UNIFORM_SIZE

    Byte size of the clipping uniform buffer.

    Functions - Core

    loadAnchor

    Loads a glb and returns a TileContent (so the main loop can draw it exactly like a tile) placed at the given geolocation. Reuses the tile drawable builder; the model's own GltfModel is owned by the returned content.

    geodeticToEcef

    Geodetic (lon/lat in radians, height in meters above the ellipsoid) to ECEF. Defaults to the WGS84 (Earth) ellipsoid; pass a/b to convert on another body — e.g. the Moon's sphere (a = b = 1,737,400) for Cesium Moon Terrain region bounds, interpreted in that body's own fixed frame. For a sphere (a == b) the eccentricity is 0, so this reduces to the plain spherical mapping.

    lonLatToEcef

    Convenience: geodetic in degrees → ECEF.

    ecefToGeodetic

    ECEF → geodetic (lon/lat in radians, height in meters) via Bowring's closed form, which is accurate to well under a millimeter for terrestrial heights.

    mat4dIdentity
    mat4dMul

    Column-major product a · b (applies b first when transforming a point).

    mat4dTransformPoint

    Transforms a point (w=1) by a column-major f64 matrix.

    mat4dFromArray

    Builds an f64 matrix from a 3D Tiles / glTF column-major 16-number array.

    mat4dTranslation

    Column-major translation matrix.

    mat4dToEngine

    Converts a fully composed, origin-relative f64 matrix to an engine Mat4. Only call this once the matrix's translation has been rebased near the world origin — collapsing a raw ECEF matrix to f32 would jitter.

    geographicTileRectangle

    Cesium's default geographic tiling scheme: level 0 has two tiles covering [−π, π] × [−π/2, π/2], each subsequent level quarters every tile. Returns the rectangle (radians) of tile (x, y, level), with y measured from the north.

    tilingSchemeForProjection

    Picks the tiling scheme from a quantized-mesh layer.json projection string: "EPSG:3857" / "mercator" / "EPSG:900913" → Web Mercator; anything else (incl. undefined / "EPSG:4326") → geographic.

    distance
    reanchorCamera

    Reanchors the floating origin under the camera when it roams past reanchorDist meters from the origin, shifting the camera GameObject to compensate so nothing moves on screen. World coordinates stay small (f32-safe) at planetary distances.

    Functions - Tilesets

    mortonIndex

    Interleaves the low bits of x, y (and z for octree) into a Morton index.

    tileBitIndex

    Availability bit index of a tile within the subtree that contains it, from its local level + local Morton index: levelOffset(localLevel) + morton.

    childSubtreeBitIndex

    Availability bit index of a child subtree (single level, no level offset).

    deriveRegion

    Subdivides a root region (radians/meters) to an implicit tile's region. y is measured from the south, matching CesiumJS.

    deriveBoxQuadtree

    Subdivides a root box (12 numbers: center, x/y/z half-axes) for a QUADTREE tile — the x and y half-axes shrink and the center shifts; the z (vertical) half-axis is kept (height is not subdivided in a quadtree).

    deriveBoxOctree

    Subdivides a root box for an OCTREE tile — like deriveBoxQuadtree but ALL THREE half-axes shrink and the center shifts along the z (vertical) axis too (an octree subdivides height as well as the horizontal extent).

    deriveRegionOctree

    Subdivides a root region for an OCTREE tile — like deriveRegion but the height range [minH, maxH] subdivides along z as well (z from the bottom).

    parseSubtreeHeader

    Parses a .subtree binary into its JSON + internal binary chunk, WITHOUT resolving availability — so the caller can resolve external buffers (an async fetch) before building the Subtree.

    resolveSubtreeBuffers

    Resolves the per-buffer byte arrays a Subtree needs. A buffer with no uri is the file's internal binary chunk; an external one (uri set) is fetched through fetchExternal (the caller resolves the URI against the subtree's base). No declared buffers → bufferViews reference the internal binary as buffer 0.

    parseSubtree

    Parses a .subtree binary with INTERNAL availability buffers only (no fetch). A referenced external buffer leaves its slot unresolved, so building the subtree throws — use parseSubtreeHeader + resolveSubtreeBuffers for those.

    makeImplicitContext

    Builds the shared context from a tile's implicitTiling JSON + content template.

    governingSubtreeRoot

    The subtree root (level/x/y) that governs a tile at the given coordinates.

    fillTemplate

    Substitutes {level}/{x}/{y}/{z} (and {version}-style) placeholders.

    hostOf

    Host bucket of a cache key, for the per-host concurrency cap: the origin host of an absolute URL key (https://host/...host), or the empty string for a synthetic key with no :// (e.g. an upsample fill, which does no fetch of its own — grouping them costs nothing). Avoids new URL (which throws on relative keys and is far slower than a couple of indexOfs called once per pending request).

    nodeWorldMatrices

    World matrices for every glTF node, in the model's local (Y-up) space.

    loadTileContent

    Loads tile content bytes into rebased, engine-ready drawables.

    buildDrawables

    Builds rebased drawables for every primitive of a loaded glTF, given the f64 contentToWorld matrix that maps the model's local (Y-up) space into the engine world frame. Shared by tile content and the geolocation anchor.

    getTileDecodePool

    Lazily-created shared decode pool (workers spawn on first TileDecodePool.decode).

    dilatePlanes

    Dilates frustum planes outward by margin world meters, for the preload ring: tiles within margin of the real frustum (just off-screen) pass the dilated test and get their content warmed, so a quick pan doesn't reveal an unloaded hole. With normalized inward-normal planes (n·w + d ≥ 0 inside), pushing a plane out by m is just d += m. Returns the input array unchanged when margin ≤ 0.

    frustumPlanes

    Extracts 6 normalized frustum planes (inward normals) from a column-major view-projection matrix (clip = M · world).

    screenSpaceError

    Screen-space error of a tile in pixels — CesiumJS's metric: a tile's geometric error projected to the screen at its camera distance. Lower target = sharper / more tiles. Returns 0 for a non-positive geometric error (a tile with no error never refines).

    loadPriority

    Streaming load priority (smaller = more urgent): camera distance, pulled forward for tiles far over the error budget so the cache resolves the most visible error first. Bounded to (0, distance], so a near tile is never starved by a far high-error one.

    Functions - Terrain

    resolveMapTilerTerrain

    Builds a MapTiler terrain source for a MapTiler Cloud API key. Optional — Cesium World Terrain via ion is the default; this is the ion-free alternative.

    decodeQuantizedMesh

    Decodes a quantized-mesh-1.0 terrain tile from its raw bytes.

    decodeDemPixel

    Decodes one DEM pixel's RGB to meters. terrarium (Mapzen/AWS):

    maptilerTerrainRgb

    MapTiler terrain-rgb (keyed).

    demToQuantizedMeshTile

    Repackages a decoded DEM height grid as a synthetic QuantizedMeshTile: a regular res × res vertex grid over the tile's geographic rectangle, so buildTerrainContent bakes it exactly like a real quantized-mesh tile (world-space transform, skirts, height sampler, imagery UVs). res is the output mesh resolution (vertices per side); the source grid is bilinear-downsampled to it.

    decodeDemTile

    Decodes a PNG/WebP DEM tile (bytes) to an size × size Float32 height grid in meters. Uses createImageBitmap + an OffscreenCanvas read-back, so it runs in the browser (and workers); it is intentionally absent from the pure demToQuantizedMeshTile path so that stays unit-testable without a canvas.

    buildTerrainContent

    Builds a world-space Mesh + terrain material from a decoded quantized-mesh tile and its rectangle. When a drape is supplied the mesh gets Web Mercator UVs into the imagery tile and the imagery as an albedo map (vertex colors go white so it shows pure); otherwise vertices carry an elevation-ramp color and the surface renders as flat shaded terrain.

    bakeTerrainGeometry

    Bakes a decoded quantized-mesh tile into interleaved world-space vertices, colors, and indices, including the skirt curtain. When drapeBlock is set, vertices get Web Mercator UVs into the imagery block and white vertex colors (so the imagery shows un-tinted); otherwise they get tile-local UVs and an elevation-ramp color.

    elevationColor

    Elevation color ramp (blue water → green → brown → gray → snow).

    skirtDepthFor

    The skirt-curtain depth (meters) for a tile, exactly CesiumJS's model: 5× the level's maximum geometric error (createQuantizedMeshTerrainData's getLevelMaximumGeometricError(level) * 5.0). This is small at fine LODs — just enough to hide the inter-LOD cracks, whose size is bounded by the geometric error — so skirts never dangle as tall curtains in high-relief terrain. (An earlier version floored this at the tile relief ×1.5, which produced hundred-meter curtains over canyons; Cesium has no such term.) Shared by the inline and worker bake so both produce identical geometry.

    getTerrainBakePool

    Lazily-created shared bake pool (workers spawn on first TerrainBakePool.bake).

    upsampleQuantizedMesh

    Builds a synthetic child QuantizedMeshTile for child quadrant (dx, dy) of a parent surface, by clipping the parent triangles to that quadrant. dx is 0 (west) or 1 (east); dy is 0 (north) or 1 (south) — matching the engine's north-down tile-y convention, where v=0 is the south edge so the north child (dy=0) takes the parent's upper-v half.

    Functions - Data Sources

    resolveIonAsset

    Resolves an ion asset endpoint. ionToken is the user's Cesium ion access token (from the in-page field).

    fetchTileBytes

    Fetches binary tile content with persistent Cache-Storage caching + data-source logging — the shared engine behind HttpDataSource.fetchArrayBuffer. Exposed as a free function so loaders that aren't a GeoDataSource can opt into the SAME persistent cache and hit-ratio logging: notably the public raster imagery in imagery.ts, which has no auth header and so previously leaned only on the browser HTTP cache (invisible to the cache HUD, not durable).

    resolveTileUri

    Resolves a 3D Tiles / terrain uri relative to its parent tileset URL, inheriting any query parameters the parent carries that the child omits. This is how a key / session token propagates down a tree: the parent (root) URL holds ?key=… (Google, MapTiler) and/or the response embeds a ?session=… (Google Photorealistic), and every descendant request inherits whatever it doesn't already specify.

    makeDataSourceLogView
    resolveGoogleTiles

    Builds a Google Photorealistic 3D Tiles source for a Map Tiles API key. Optional — the default datasets still flow through Cesium ion; this is the ion-free alternative.

    Functions - Imagery

    mercatorTileForRect

    The deepest (highest-resolution) Web Mercator tile that fully contains the geographic rectangle — so a single imagery fetch covers the whole terrain tile and every vertex UV lands in [0,1].

    mercatorUv

    UV of a lon/lat (radians) within tile (v=0 at the tile's north edge).

    xyzImagery

    Builds an ImageryProvider from a standard XYZ URL template — covers OSM and almost every OSM-derived basemap (Carto, Stadia, self-hosted tileserver, …).

    stadiaImagery

    Stadia Maps raster basemap (OSM-based, retina 512 px). Keyless from localhost / an allowed domain; pass a Stadia key for production. style is e.g. alidade_smooth, alidade_smooth_dark, osm_bright, outdoors. See https://stadiamaps.com.

    imageryUrl

    Tile URL for a provider (default Esri). Back-compat shim; prefer ImageryProvider.url.

    mercatorBlockForRect

    The deepest Mercator tile block (≤ MOSAIC_MAX_PER_AXIS tiles per axis) that covers the geographic rectangle. Deeper than mercatorTileForRect (which is limited to one tile) and immune to its straddle step-back.

    mercatorBlockAtZoom

    A Mercator tile block covering the rectangle at a specific zoom z (vs mercatorBlockForRect, which picks the deepest zoom ≤ MOSAIC_MAX_PER_AXIS per axis). Used by loadImageryWithFallback to step to a coarser, more widely-available level when the deepest block 404s. Coarser zooms cover the rect in fewer tiles, so the per-axis count only shrinks.

    mercatorBlockUv

    UV of a lon/lat (radians) within a MercTileBlock (v=0 at the block's north edge), i.e. into the composited mosaic texture.

    loadImageryMosaic

    Fetches every tile of a MercTileBlock and composites them into one sRGB texture (cols·256 × rows·256). Tiles are placed by copyExternalImageToTexture into their grid cell; a failed tile leaves its cell zero-cleared (rare at valid zooms). Throws only when every tile failed, so the caller can fall back to flat coloring (mirrors the single-tile path).

    loadImageryWithFallback

    Loads the imagery mosaic for a terrain tile's rectangle, falling back to progressively COARSER Mercator zooms when the deepest block can't be fetched (typically Esri 404s for areas it doesn't cover to the deepest level). This is the imagery-pyramid equivalent of CesiumJS draping a ready ancestor imagery tile while the exact-level one is unavailable: rather than dropping the tile to the flat elevation ramp, it keeps real aerial imagery at a lower resolution. Returns the texture together with the block it was actually loaded at (so the terrain vertex UVs map into the right block), or null only when every level — down to the world-spanning z0 — failed (genuine network outage), where the caller falls back to the elevation ramp.

    loadImageryTexture

    Fetches one imagery tile and uploads it as an sRGB Texture. Goes through the shared persistent Cache-Storage path (fetchTileBytes), so repeats are served from the same durable store as ion/DEM/vector tiles. Throws on HTTP error so the caller can fall back to flat coloring.

    imageryStack

    Builds an ImageryStack from an ordered layer list (base first).

    imageryStackAttribution

    Combined attribution for every provider in a stack (deduped, " · "-joined).

    blockRemapUv

    Pure mirror of the compositor shader's block remap: the UV into layer's block for the texel at UV uv of base's block (both Web Mercator). Exposed for unit testing the math without a device. When the two blocks are the same it's the identity.

    loadImageryStack

    Loads + composites an ImageryStack for a terrain tile's rectangle into one draped texture, mirroring loadImageryWithFallback's return shape (so the terrain path is unchanged). Each layer's mosaic is fetched best-effort; failed layers are dropped, and the first that loads becomes the base block. A single identity layer skips the composite pass. Returns null only when every layer failed (→ caller falls back to the elevation ramp).

    Functions - Vector & GeoJSON

    parseGeoJson

    Parses a GeoJSON object (a FeatureCollection, a Feature, a GeometryCollection, or a bare geometry) into a ParsedGeoJson. Malformed parts are skipped rather than thrown on, so one bad feature doesn't drop a whole dataset; pass an already-JSON.parsed object (this module does no fetching).

    buildPolygons

    Bakes polygon features into one merged world mesh: a triangulated fill (hole-aware), or — when extrudeHeight resolves above the base — extruded prisms (vertical walls with outward horizontal normals + a flat roof cap). Returns null when nothing was emitted.

    buildPolylines

    Bakes polyline features into a flat ribbon mesh of constant world width: each segment is a quad offset ±half-width perpendicular to its direction in the local tangent plane, the vertices welded at joints (a simple miter-free strip). Returns null when nothing emitted.

    buildLineSegments

    Bakes polyline features into a flat instance buffer of world-space SEGMENTS for a screen-constant-width line pass (each consecutive vertex pair → one instance). Unlike buildPolylines (which makes a constant-WORLD-width ribbon mesh for the deferred path), this leaves the width to the line feature's vertex shader. Layout per instance: posA(3) posB(3) rgba(4) = 10 floats / 40 bytes. Returns null when nothing was emitted.

    buildPointAnchors

    Resolves point features to ECEF anchors (no world geometry — points render as screen-space labels / billboards, which want a stable ECEF position).

    buildPolygonAnchors

    Resolves polygon features to ECEF label anchors at each exterior-ring centroid — so a park / building can carry a name label even though it isn't a point feature. The anchor sits at the roof height for an extruded polygon (else the base), plus labelHeightOffset.

    geoJsonPointLabels

    Maps GeoJSON anchors to GeoLabels: text from opts.textProperty (default name), ECEF anchor straight through. Anchors missing a non-empty string value are skipped.

    fetchGeoJson

    Fetches + parses a GeoJSON document by URL. No tiling — GeoJSON is a single document, so this is a plain cached fetch (not the tileset HttpDataSource machinery); throws on a non-OK response or HTML (a misrouted error page) instead of a JSON body.

    parseColor

    Parses a CSS color string (hex / rgb()/rgba() / hsl()/hsla() / a few names) to LINEAR RGB, or undefined for an expression / unrecognized value (the caller then uses a default).

    evalFilter

    Evaluates a MapLibre filter (legacy ['==','class','grass'] or expression ['==',['get','class'],'grass']) against a feature's properties. Handles the common operators; anything it doesn't recognize passes (so a feature is never wrongly dropped). $type/geometry comparisons always pass (the build buckets already separate points/lines/polygons).

    parseMapLibreStyle

    Parses a MapLibre style document into the builder config, evaluating zoom-dependent values at zoom (use the tile zoom the layers will render at — ~14 for buildings).

    loadMapLibreStyle

    Fetches + parses a MapLibre style JSON from a URL.

    decodeMvt

    Decodes an MVT tile into its layers. Gzip is NOT handled here — pass already-inflated bytes (providers serve .pbf either raw or Content-Encoding: gzip, which the browser inflates).

    ringArea

    Signed area of a ring (shoelace). In MVT's y-down tile space an exterior ring is clockwise → positive area; a hole is counter-clockwise → negative.

    earClip

    Ear-clipping triangulation of a simple polygon (no holes), returning index triplets into the input ring. Orientation-agnostic: the ring is normalized to CCW first, and the result is used with double-sided rendering, so world winding doesn't matter.

    maptilerVector

    MapTiler OpenMapTiles vector tiles (keyed).

    Functions - Geodesy

    mercatorTileRect

    Geographic rectangle (radians) of a Web Mercator XYZ tile. y is north-down (slippy): row 0 is the north edge.

    demTileSphere

    Tight bounding sphere (ECEF) of a tile's geographic rectangle between minH/maxH (m): the centroid + max-distance of the 18 corner/edge/center samples at both heights.

    Functions - Time-Dynamic

    loadCzml

    Parse a CZML document (already JSON.parsed — an array of packets) into a CzmlDocument. The document packet supplies the Clock; every other packet becomes a CzmlEntity.

    loadCzmlUrl

    Fetch a CZML document by URL and parse it.

    Functions - Other

    getActiveGeoScene

    The GeoScene currently active for an engine (set by a GeoWorld), or null.

    registerGeoComponents

    Register the geo component factories (idempotent; called on module import).

    parseIsoTime

    Parse an ISO-8601 time (2026-06-14T12:00:00Z) to epoch seconds. Throws on a bad string.

    formatIsoTime

    Format epoch seconds back to an ISO-8601 string (UTC).

    References

    IonAttribution → Attribution