OpenZenith Core — WASM Decoder Demo

Loading WASM...

Benchmarks

OperationTimeDetails

D8 Flow Direction (3×3 pit DEM)

Direction colours: White=E, LightBlue=SE, Cyan=S, Green=SW, Lime=W, Yellow=NW, Orange=N, Red=NE. Pit cell (top-left) = black.

Flow Accumulation (3×3 pit DEM)

Upstream cell count. White = no upstream (peaks/ridges). Red = high accumulation (streams).

Viewshed — Mt. Everest (30×30 synthetic DEM)

Observer at the yellow cell (2m eye height). Green = visible, Brown = hidden.

Exported Functions

// Load WASM from CDN
import init from '@/lib/wasm/openzenith_core.js';
const wasm = await init('/pkg/openzenith_core_bg.wasm');

// D8 flow direction — returns Uint8Array of 0-7 direction codes
const fdPtr = d8_flow_direction_wasm(demPtr, len, rows, cols, nodata);

// Flow accumulation — returns Uint32Array of upstream counts
const accPtr = flow_accumulation_wasm(fdPtr, len, rows, cols, nodataDir);

// Gradient reconstruction from OZT2 residuals
const elevPtr = gradient_reconstruct_wasm(residualsPtr, len, h, w,
                                          nodata, dequantMin, dequantScale);

// Viewshed from DEM
const visPtr = viewshed_wasm(demPtr, len, rows, cols,
                              observerRow, observerCol,
                              observerHeight, cellSize, nodata);

// Full OZT2 tile decode (header parsing + decompress + reconstruct)
const { elevations, metadata } = decode_ozt2(tileBytes, decompressFn);