Skip to main content

WKT module · geometry loader

HexWKBLoader

Decode WKB represented as hexadecimal text when a database, API, or JSON envelope cannot carry raw binary bytes directly.

What it reads

Cross the text-to-binary boundary once.

HexWKBLoader accepts hexadecimal WKB and returns the same structured geometry shape as the binary WKB loader, so downstream GIS code does not need to care how the bytes arrived.

Input

Hexadecimal text containing WKB bytes

Output

Structured geometry positions

Dimensions

Two to four coordinate dimensions

APIs

load, parse, and parseSync

Detailed guide

HexWKBLoader reference

The sections below document installation, usage, WKB geometry details, and the relationship between hexadecimal and binary inputs.

From-v2.2

Loader for hex encoded Well-known binary format for representation of geometry.

HexWKBLoader
File Extension.wkb,
File TypeBinary
File FormatWell 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 {HexWKBLoader} from '@loaders.gl/geospatial/wkb/bundled';
import {parseSync} from '@loaders.gl/core';

const hexWkb = '0101000000000000000000f03f0000000000000040';
const data = parseSync(hexWkb, HexWKBLoader);
// => {type: 'Point', coordinates: [1, 2]}
import {HexWKBLoader} from '@loaders.gl/geospatial/wkb';
import {load} from '@loaders.gl/core';

const data = await load(url, HexWKBLoader);

Options​

N/A

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

image