Skip to main content

WKT module · geometry loader

WKTLoader

Parse readable Well-Known Text geometry into the loaders.gl geometry representation used by mapping, analysis, and conversion pipelines.

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 TypeText
File FormatWell Known Text
Data FormatGeometry
Supported APIsload, parse, parseSync
Decoder TypeSynchronous
Worker Thread✅ Yes Website shields.io

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).