Skip to main content

readWktSequence

Reads WKT text that holds one geometry or more, one after another in any layout (one to a line is the usual one), into GeoJSON geometries in the same way as parseWkt, with the same limits and the same errors.

This is a function exported by @mapcairn/core, checked against version 0.2.0.

Signature​

import { readWktSequence } from "@mapcairn/core";

function readWktSequence(text: string, options?: ParseWktOptions): Geometry[];

Description​

Unlike parseWkt it does not check the shapes it reads: an EMPTY shape, a line of one position or coordinates outside the world come back as written. It is for a caller that applies its own rules to each shape, such as the draw tool's import; use parseWkt where a valid geometry is needed.

Parameters​

  • text (string)
  • options? (ParseWktOptions)

Returns​

Geometry[]

Throws​

  • GeometryError of kind invalid for text that is not WKT, and unsupported for a valid WKT feature this reader leaves out. Nothing is returned for text that fails part of the way.

See also​

Source: packages/core/src/geometry/wkt.ts:874