TWKBLoader 🚧
Loader for the Well-known binary format for representation of geometry.
Loader | Characteristic |
---|---|
File Extension | .wkb , |
File Type | Binary |
File Format | [Tiny Well Known Binary][twkb] |
Data Format | Geometry |
Supported APIs | load , parse , parseSync |
Decoder Type | Synchronous |
Worker Thread Support | Yes |
Installation​
npm install @loaders.gl/wkt
npm install @loaders.gl/core
Usage​
import {TWKBLoader} from '@loaders.gl/wkt';
import {parseSync} from '@loaders.gl/core';
// prettier-ignore
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, TWKBLoader);
// => { positions: { value: Float64Array(2) [ 1, 2 ], size: 2 } }
import {TWKBLoader} from '@loaders.gl/wkt';
import {load} from '@loaders.gl/core';
const data = await load(url, TWKBLoader);
Options​
N/A
Format Summary​
Well-known binary (WKB) is a binary geometry encoding to store geometries (it doesn't store attributes). It's used in databases such as PostGIS and as the internal storage format of Shapefiles. It's also being discussed as the internal storage format for a "GeoArrow" specification. WKB is defined starting on page 62 of the OGC Simple Features specification.
It's essentially a binary representation of WKT. For common geospatial types
including (Multi) Point
, Line
, 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