Skip to main content

formatWkt

Writes a GeoJSON geometry, or the geometry of a feature, as Well-Known Text in the form parseWkt reads back: upper-case type names, one space between a position's numbers, , between positions, a Z tag when positions have a height, and EMPTY for a shape with no positions. Every MULTIPOINT member is bracketed.

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

Signature​

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

function formatWkt(input: Geometry | Feature, options?: FormatWktOptions): string;

Description​

The geometry is checked for shape but not for the range of its coordinates, so projected coordinates can be written too.

Parameters​

  • input (Geometry | Feature)
  • options? (FormatWktOptions)

Returns​

string

Throws​

  • GeometryError of kind invalid for a malformed geometry or a bad precision, empty for a feature with no geometry.

See also​

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