SDK JS
    Preparing search index...

    Module @bitruvius/turbo-lerc

    @bitruvius/turbo-lerc — Esri LERC raster decode in the browser.

    Decodes LERC1/LERC2 blobs (elevation / coverage) to single-band Float32Array rasters with an optional per-pixel validity mask. Start with LercDecoder and its LercDecoder.decode method; the result is a LercRaster. Rendering (colormap raster, hillshade, terrain mesh) is a separate, viewer-specific concern.

    Bitruvius

    @bitruvius/turbo-lerc

    Same LERC wire format. Much faster decode.

    A SIMD-optimized LERC decoder for the browser, byte-for-byte compatible with the LERC reference. Point it at the tiles you already serve, get the same values out, sooner.

    Turbocharged by Bitruvius TurboLERC.

    Hand-written SIMD across every backend: AVX2 on x86_64, NEON on Apple Silicon and Graviton, and WASM SIMD128 in the browser running at 60–107% of native throughput. No emscripten, no JavaScript fallback path doing the real work.

    Decode speedup against the LERC reference, by corpus:

    Corpus Decode
    Hyperspectral 1.9×
    Multispectral 1.9×
    SAR Video 1.8×
    SAR Complex 1.8×
    Optical 1.5×
    Lidar Intensity 1.4×
    LiDAR DSM 1.4×
    Terrain Aspect 1.3×

    That is the full published chart, not the top of it. Each figure is the median across the matched corpus, as published on bitruvius.com/turbolerc. These are our own measurements under that methodology; results vary by workload and hardware, so benchmark your own tiles before you count on a number.

    Compression is untouched, because the bytes are untouched. On a lidar DEM (f32), TurboLERC and the reference both land at a 2.58× compression ratio. Same compression bar, different speed bar.

    import { LercDecoder } from '@bitruvius/turbo-lerc';

    const bytes = new Uint8Array(await (await fetch(TILE_URL)).arrayBuffer());
    const raster = await new LercDecoder().decode(bytes);

    raster.width; // 1024
    raster.zMin; // real min, straight from the header, no manual scan
    raster.zMax; // real max
    raster.values; // Float32Array, row-major, first band
    raster.mask; // Uint8Array, 1 valid / 0 nodata, when the raster has holes

    That is the whole API for the common case. Integer, float and double sources all normalize to Float32Array, the natural target for elevation and coverage rendering, so your render path stops caring what the publisher chose.

    lercDataTypeName(raster.dataType) gives you the source type as a string if you do care. Call decoder.dispose() when a layer tears down to hand back the wasm heap.

    npm i @bitruvius/turbo-lerc
    

    Decoder only, and free. This package is the TurboLERC decoder. Production encoding is a separate commercial license through the Bitruvius Developer Hub. Nothing here encodes LERC, so do not plan a write path around it.

    LERC1 and LERC2. Legacy v1 (CntZImage) blobs decode transparently, same call.

    First band, single depth. v1 covers the headline DEM and coverage case. Multi-band RGB rasters are a follow-up, not supported yet.

    No build tax. The pure-Rust wasm is committed to the package, so consumers build with only Bun. A self-contained ESM bundle is also published on the Bitruvius CDN if you would rather skip the bundler. Browsers need script-src 'wasm-unsafe-eval' in CSP.

    Decode is golden-tested against real Esri-produced rasters: a LERC2 float DEM and two legacy v1 Terrain3D tiles, including a known-bad-tile regression. Rendering (colormap raster, hillshade, terrain mesh) is a separate, viewer-specific concern: see @bitruvius/sdk-maplibre for georeferenced terrain.

    Esri, ArcGIS, and LERC are trademarks of Environmental Systems Research Institute, Inc. Apple and Apple Silicon are trademarks of Apple Inc. Intel is a trademark of Intel Corporation. All other marks are the property of their respective owners.

    These names are used solely to identify the data formats this software interoperates with. Bitruvius is not affiliated with, sponsored by, or endorsed by any of them, and no such relationship is implied.

    TurboLERC is an independent implementation of the openly published LERC format. Compatibility claims, including byte-for-byte output, describe interoperability with that format as verified by our test suites. LERC is published by Esri under the Apache 2.0 license.

    Proprietary. The full terms ship as LICENSE inside this package, and are readable before installing at cdn.bitruvius.com/legal/sdk-license-v1.txt.

    © Bitruvius, Inc.

    Classes

    LercDecoder

    Interfaces

    LercDecoderOptions
    LercRaster
    WasmHostInit

    Type Aliases

    LercDataType

    Variables

    LERC_DATA_TYPES

    Functions

    lercDataTypeName
    resetWasm