What it reads
Keep geometry compact without losing its structure.
WKB stores geometry as binary coordinates and topology without feature attributes. It is a useful boundary format for databases, shapefiles, and columnar geometry pipelines.
Input
Binary WKB geometry bytes
Output
Structured positions and geometry
Dimensions
Two to four coordinate dimensions
APIs
load, parse, and parseSync
Detailed guide
WKBLoader reference
The sections below document format metadata, installation, usage, geometry details, and attribution.
Loader for the Well-known binary format for representation of geometry.
| WKBLoader | |
|---|---|
| File Extension | .wkb, |
| File Type | Binary |
| File Format | 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 {WKBLoader} from '@loaders.gl/geospatial/wkb/bundled';
import {parseSync} from '@loaders.gl/core';
// biome-ignore format: preserve intentional fixture layout
const buffer = new Uint8Array([
1, 1, 0, 0, 0, 0, 0,
0, 0, 0, 0, 240, 63, 0,
0, 0, 0, 0, 0, 0, 64
]).buffer;
const data = parseSync(buffer, WKBLoader);
// => {type: 'Point', coordinates: [1, 2]}
import {WKBLoader} from '@loaders.gl/geospatial/wkb';
import {load} from '@loaders.gl/core';
const data = await load(url, WKBLoader);
Asynchronous parsing uses the bundled worker automatically when workers are enabled. When bundling with Vite, the worker URL can be supplied explicitly:
import WKT_WORKER_URL from '@loaders.gl/geospatial/wkt-worker.js?url';
import {parse} from '@loaders.gl/core';
import {WKBLoader} from '@loaders.gl/geospatial/wkb';
const data = await parse(buffer, WKBLoader, {wkb: {workerUrl: WKT_WORKER_URL}});
Options
| Option | Type | Default | Description |
|---|---|---|---|
wkb.workerUrl | string | CDN URL | Override the shared WKT/WKB worker URL. |
Format Summary
WKB encodes geometry without a feature's attributes. It is used in spatial
databases and in the geoarrow.wkb geometry extension. Shapefile geometry records
use their own binary layout; they are not WKB records. See the
WKB format page for compatibility details.
It's essentially a binary representation of WKT. For common geospatial types
including (Multi) Point, LineString, and Polygon, there's a 1:1 correspondence
between WKT/WKB and GeoJSON. WKT and WKB also support extended geometry types,
such as Curve, Surface, and TIN, which don't have a correspondence to
GeoJSON.
- Coordinates can be 2-4 dimensions and are interleaved.
- Positions stored as double precision
