LERC for Linux
v4.2.0LinuxLERC 4.2.0 for native Node.js addons on Linux, precompiled for x64 and arm64, glibc 2.28 or later as @crossbind/port-lerc-linux.
npm install @crossbind/port-lerc-linux@betaInstall
The addons and their loader land in dist; the Node.js playbook has the whole flow.
Usage
The examples the WebAssembly page runs, as Linux compiles them: the same headers and the same calls. They are checked on the WebAssembly build.
Compress heights to within 1 cm
LERC's main job: lerc_encode stores a float raster so that no value moves by more than the error you allow, and lerc_decode reads it back. The example checks the bound on every one of the 65,536 heights.
LERC 4.2.0: 262144 B of float32 heights -> 94775 B largest error 0.0099 m, within 1 cm: true
Read a blob's header without decoding it
lerc_getBlobInfo answers from the header alone: size, data type, bands, valid pixels, the value range and the largest error the encoder allowed. A tile viewer uses it to size its buffers, or to skip an empty tile, before decoding. The blob comes from the codec in the first example, which asks for one float32 step less than 10 cm.
Lerc2 v6: 256x256, 1 band of float32, 65536 valid pixels, 67591 B heights 1032.268 to 1500.945 m, stored within 0.099878 m
Keep integer data exact
Class maps and sensor counts must not change at all. With a maxZError of 0, LERC stores integers exactly (it raises 0 to 0.5, which rounds back to the same whole number) and float32 bit for bit. Here, a 12-bit sensor band in 16-bit pixels.
uint16, 256x256: 131072 B -> 59091 B identical: true
Leave out pixels that have no data
Rasters mark gaps with a NoData value such as -9999. Stored as a height, it stretches the value range of every block it lands in. Passed as the validity mask (pValidBytes in lerc_encode and lerc_decode), it costs at most a bit per pixel, and decoding hands the mask back.
-9999 stored as a height: 147759 B -9999 as missing pixels: 98308 B 1273 gaps come back as -9999, largest error elsewhere 0.0099 m
What is different on Linux
crossbind build -p linuxlinks one.nodeaddon per architecture intodist, next to a loader,dist/<name>.native.cjs, thatrequireandimportboth load. A plaincrossbind buildskips it.await initNative()once, then call the classes: calls are synchronous, and no Worker is involved.- The library and the C++ runtime are linked into the addon statically. It runs on glibc 2.28 or later (RHEL 8, Debian 10, Ubuntu 20.04 and newer), not on musl distributions such as Alpine.
- There is no
m.FS: the C++ reads real paths, and data such asGDAL_DATAorproj.dbis copied todist/data. - The build runs in Docker on any host, a Mac included.
worker_threadsare not supported yet.
Other platforms
- LERC overview: the apps, every platform's setup and the packages.
- LERC for WebAssembly: browsers, Node.js and edge runtimes.
- LERC for Android: React Native apps on Android.
- LERC for iOS: React Native apps on iOS.
- LERC for macOS: native Node.js addons and Electron on macOS.
- LERC for Windows: native Node.js addons on Windows.
- LERC for WASI: command-line programs under wasmtime.
Facts on this page come from the port manifests in the repository and from what npm served on beta when the site was built. See the Libraries guide for the full consumer flow.