What it reads
Reconstruct geometry from compact integer records.
TWKB reduces transport size by quantizing coordinates and storing neighboring positions as deltas. The loader handles that binary representation before returning structured geometry data.
Input
Tiny Well-Known Binary bytes
Encoding
Quantized coordinates, deltas, and varints
Output
Structured geometry positions
APIs
load, parse, and parseSync
Detailed guide
TWKBLoader reference
The sections below document installation, usage, the compact geometry encoding, and the current loader behavior.
Loader for Tiny Well-Known Binary, a compact geometry encoding distinct from WKB.
| TWKBLoader | |
|---|---|
| File Extension | .twkb |
| File Type | Binary |
| File Format | Tiny Well Known Binary |
| Data Format | Geometry |
| Supported APIs | load, parse, parseSync |
| Decoder Type | Synchronous |
| Worker Thread | ✅ Yes |
Installation
npm install @loaders.gl/geospatial
npm install @loaders.gl/core
Usage
import {TWKBLoader} from '@loaders.gl/geospatial/wkb/bundled';
import {parseSync} from '@loaders.gl/core';
// Precision zero, Point (1, 2), zigzag-encoded coordinates.
const buffer = new Uint8Array([1, 0, 2, 4]).buffer;
const data = parseSync(buffer, TWKBLoader);
// => {type: 'Point', coordinates: [1, 2]}
import {TWKBLoader} from '@loaders.gl/geospatial/wkb';
import {load} from '@loaders.gl/core';
const data = await load(url, TWKBLoader);
Options
N/A
Format summary
TWKB stores quantized coordinates as variable-length integers, with deltas between successive positions. Precision is encoded in the header. It does not store WKB's double-precision coordinate records. See the TWKB format page for supported geometry types and format boundaries.