What it reads
Use text when the geometry should stay inspectable.
WKT is easy to log, inspect, and exchange. WKTLoader handles the geometry syntax boundary and returns structured geometry without attaching feature attributes.
Input
Readable WKT geometry text
Output
Structured geometry coordinates
Types
Points, lines, polygons, and extensions
APIs
load, parse, and parseSync
Detailed guide
WKTLoader reference
The sections below document format metadata, installation, usage, options, and attribution.
Loader and writer for the Well-known text format for representation of geometry.
| WKTLoader | |
|---|---|
| File Extension | .wkt, |
| File Type | Text |
| File Format | Well Known Text |
| 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 {WKTLoader} from '@loaders.gl/geospatial/wkt/bundled';
import {parseSync} from '@loaders.gl/core';
const data = parseSync('LINESTRING (30 10, 10 30, 40 40)', WKTLoader);
// => {type: 'LineString', coordinates: [[30, 10], [10, 30], [40, 40]]}
import {WKTLoader} from '@loaders.gl/geospatial/wkt';
import {load} from '@loaders.gl/core';
const data = await load(url, WKTLoader);
Options
N/A
Attribution
The WKTLoader is based on a fork of the Mapbox wellknown module under the ISC license (MIT/BSD 2-clause equivalent).