SDK JS
    Preparing search index...

    Interface AddEsriTerrainOptions

    Options for addEsriTerrain.

    interface AddEsriTerrainOptions {
        attribution?: string;
        auth?: RequestAuthorizer;
        cache?: false | { maxEntries: number };
        cameraFloor?: number | false;
        encoding?: DemEncoding;
        exaggeration?: number;
        gestureSnapFix?: boolean;
        id?: string;
        maplibregl: MapLibreNamespace;
        nodata?: NodataPolicy;
        onError?: (error: unknown) => void;
        output?: DemTileOutput;
        poolSize?: number;
        requestInit?: RequestInit;
        scheme?: string;
        setAsTerrain?: boolean;
        spawn?: () => Worker;
        tileLod?: false | TileLodParams;
        url: string;
        useWorker?: boolean;
        wasmInit?: WasmHostInit;
    }
    Index

    Properties

    attribution?: string

    Override the displayed attribution (default: the service's own copyrightText).

    auth?: RequestAuthorizer

    Request authorizer for tile + metadata requests (secured ArcGIS ImageServer). Pass an ESRI authorizer (e.g. getEsriAuthorizer()), or configure one globally with configureEsriAuth() and omit this. Public terrain needs neither.

    cache?: false | { maxEntries: number }

    Optional in-memory decoded-tile cache, keyed by entry count (default off). Budget note: on the bitmap path an entry holds the raw RGBA grid — ~(tileSize+1)²·4 bytes (~264 KB at 256 px), larger than the old compressed-PNG entries. Size maxEntries accordingly.

    cameraFloor?: number | false

    Minimum camera height above the rendered terrain, metres (default 2): the camera can never end a camera update under the DEM. Enforced on every gesture/animation via acquireCameraFloor while this call owns the terrain; released on remove(). Pass false to disable, or a number to change the margin. Not applied with setAsTerrain: false.

    encoding?: DemEncoding

    DEM re-encoding (default 'terrarium').

    exaggeration?: number

    Terrain vertical exaggeration, unitless multiplier (default 1).

    gestureSnapFix?: boolean

    Suppress MapLibre's terrain gesture-end camera snap-back while this call owns the terrain (default true). On gesture end MapLibre reconciles the frozen gesture elevation against a fresh DEM sample; at a tilt that slides the centre by Δe·tan(pitch), which reads as the view jumping backward. The fix is applied automatically via preventTerrainGestureSnap and released on remove(). Pass false to keep stock behavior. Not applied with setAsTerrain: false (the caller owns the terrain attach — call the utility directly if wanted).

    id?: string

    Source id (default 'esri-terrain').

    maplibregl: MapLibreNamespace

    The caller's maplibre-gl namespace — injected so this package never imports maplibre-gl.

    nodata?: NodataPolicy

    How to fill pixels no layer covers; see NodataPolicy. Defaults to zero-fill (sea level).

    onError?: (error: unknown) => void

    Called if terrain decode degrades — today: the decode worker pool could not be spawned (cross-origin CDN bundle, or a CSP without worker-src blob:) and DEM tiles fall back to the main thread. Terrain still renders, much more slowly; without a handler this is only a one-time console.warn.

    output?: DemTileOutput

    Protocol payload format (default 'bitmap'): hand MapLibre a ready ImageBitmap — skipping both our PNG encode and MapLibre's main-thread PNG decode — with automatic per-realm fallback to 'png' where createImageBitmap is unavailable. Pass 'png' to force the fallback.

    poolSize?: number

    Decode worker pool size (default ~hardwareConcurrency−1, capped at 4).

    requestInit?: RequestInit

    Static fetch options for tile + metadata requests (e.g. auth headers).

    scheme?: string

    Protocol scheme registered via addProtocol (default 'esri-dem').

    setAsTerrain?: boolean

    When false, only add the source — don't call setTerrain (default true).

    spawn?: () => Worker

    Override worker creation (CDN/CSP escape hatch).

    tileLod?: false | TileLodParams

    Terrain LOD tuning for horizon/behind-camera continuity at high pitch (maps to MapLibre setSourceTileLodParams; see TileLodParams). Defaults to a modest continuity-favoring setting (DEFAULT_TILE_LOD); pass false to keep MapLibre's defaults. (Complement with the maxTileCacheZoomLevels map-constructor option for gap-free pan-back — that one can only be set when you create the map.)

    url: string

    Esri elevation ImageServer URL (global Terrain3D or any custom hosted DEM).

    useWorker?: boolean

    false decodes on the main thread instead of a worker pool (default worker pool).

    wasmInit?: WasmHostInit

    turbo-lerc wasm init (bytes/url) forwarded to the decode workers — for the cross-origin CDN fallback; see @bitruvius/geo-core's BitruviusConfig.wasmBaseUrl.