Skip to main content

WKT module · geometry loader

TWKBLoader

Parse Tiny Well-Known Binary geometry and expose it through the same application-facing geometry shape used by the WKT module.

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.

From-v4.0

Loader for Tiny Well-Known Binary, a compact geometry encoding distinct from WKB.

TWKBLoader
File Extension.twkb
File TypeBinary
File FormatTiny Well Known Binary
Data FormatGeometry
Supported APIsload, parse, parseSync
Decoder TypeSynchronous
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.