# @terraformer/wkt

> Tools to convert WKT geometries to GeoJSON geometries and vica-versa.

Latest version **2.2.2** (published 2026-06-29) · MIT license · 0 weekly downloads

## Install

```sh
npm install @terraformer/wkt
pnpm add @terraformer/wkt
yarn add @terraformer/wkt
bun add @terraformer/wkt
```

## Health

**Score 63/100 (C)** — status: active.

Positive: has types package; esm support; no vulnerabilities; recently updated; high maintenance score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 2.2.2 |
| Published | 2026-06-29 |
| First published | 2020-04-16 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | separate (@types/terraformer__wkt) |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 89.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 240 |
| Author | Jerry Sievert |
| Maintainers | jgravois, jerrysievert, gavinr, patrickarlt |
| Keywords | wkt, convert, geo, geojson, geometry |

## Links

- npm: https://www.npmjs.com/package/@terraformer/wkt
- Repository: https://github.com/terraformer-js/terraformer
- Issues: https://github.com/terraformer-js/terraformer/issues
- npm.io page: https://npm.io/package/@terraformer/wkt

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 2.2.2 (latest) — 2026-06-29
- 2.2.1 — 2024-05-15
- 2.2.0 — 2023-03-28
- 2.1.2 — 2022-08-02
- 2.1.1 — 2022-06-01
- 2.0.7 — 2020-05-18
- 2.0.6 — 2020-05-18
- 2.0.5 — 2020-05-17
- 2.0.3 — 2020-04-16
- 2.0.1 — 2020-04-16
- 2.0.0 — 2020-04-16

## README

# @terraformer/wkt

[![npm][npm-image]][npm-url]
[![travis][travis-image]][travis-url]
[![standard][standard-image]][standard-url]

[npm-image]: https://img.shields.io/npm/v/@terraformer/wkt.svg?style=flat-square
[npm-url]: https://www.npmjs.com/package/@terraformer/wkt
[travis-image]: https://app.travis-ci.com/terraformer-js/terraformer.svg?branch=main
[travis-url]: https://app.travis-ci.com/terraformer-js/terraformer
[standard-image]: https://img.shields.io/badge/code%20style-semistandard-brightgreen.svg?style=flat-square
[standard-url]: http://npm.im/semistandard

> Tools to convert WKT geometries to GeoJSON geometries and vice versa.

## Install

```shell
npm install @terraformer/wkt
```

## API Reference

<a name="module_Terraformer"></a>

## Terraformer

* [Terraformer](#module_Terraformer)
    * [.wktToGeoJSON(WKT)](#module_Terraformer.wktToGeoJSON) ⇒ <code>object</code>
    * [.geojsonToWKT(GeoJSON)](#module_Terraformer.geojsonToWKT) ⇒ <code>string</code>

<a name="module_Terraformer.wktToGeoJSON"></a>

### Terraformer.wktToGeoJSON(WKT) ⇒ <code>object</code>
Converts a [WKT](https://en.wikipedia.org/wiki/Well-known_text_representation_of_geometry) geometry into a GeoJSON geometry.

**Kind**: static method of [<code>Terraformer</code>](#module_Terraformer)  
**Returns**: <code>object</code> - GeoJSON.

```js
import { wktToGeoJSON } from "@terraformer/wkt"

wktToGeoJSON("POINT (-122.6764 45.5165)");

>> { "type": "Point", "coordinates": [ -122.6764, 45.5165 ] }
```  

| Param | Type | Description |
| --- | --- | --- |
| WKT | <code>string</code> | The input WKT geometry. |

<a name="module_Terraformer.geojsonToWKT"></a>

### Terraformer.geojsonToWKT(GeoJSON) ⇒ <code>string</code>
Converts a GeoJSON geometry or GeometryCollection into a [WKT](https://en.wikipedia.org/wiki/Well-known_text_representation_of_geometry) string.

**Kind**: static method of [<code>Terraformer</code>](#module_Terraformer)  
**Returns**: <code>string</code> - WKT.
```js
import { geojsonToWKT } from "@terraformer/wkt"

const geojsonPoint = {
  "type": "Point",
  "coordinates": [-122.6764, 45.5165]
}

geojsonToWKT(geojsonPoint)

>> "POINT (-122.6764 45.5165)"
```  

| Param | Type | Description |
| --- | --- | --- |
| GeoJSON | <code>object</code> | The input GeoJSON geometry or GeometryCollection. |

* * *

## Usage

### Browser (from CDN)

This package is distributed as a [UMD](https://github.com/umdjs/umd) module and can also be used in AMD based systems or as a global under the `Terraformer` namespace.

```html
<script src="https://unpkg.com/@terraformer/wkt"></script>
```
```js
Terraformer.wktToGeoJSON("POINT (-122.6764 45.5165)");
```

### Node.js

```js
const Terraformer = require('@terraformer/wkt');

Terraformer.geojsonToWKT(/* ... */);
Terraformer.wktToGeoJSON(/* ... */);
```

### ES module in the browser

```html
<script type='module'>
  import { wktToGeoJSON } from 'https://unpkg.com/@terraformer/wkt?module';

  // look ma, no build step!
  wktToGeoJSON(/* ... */);
</script>
```

## [Contributing](./CONTRIBUTING.md)

## [LICENSE](https://raw.githubusercontent.com/terraformer-js/terraformer/master/LICENSE)

---
_Source: https://npm.io/package/@terraformer/wkt · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
