# wellknown

> convert wkt to geojson

Latest version **0.5.0** (published 2016-07-22) · BSD license · 0 weekly downloads

## Install

```sh
npm install wellknown
pnpm add wellknown
yarn add wellknown
bun add wellknown
```

Provides the command `wellknown`.

## Health

**Score 33/100 (F)** — status: abandoned.

Positive: has types package; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 0.5.0 |
| Published | 2016-07-22 |
| First published | 2013-09-09 |
| Weekly downloads | 0 |
| License | BSD |
| TypeScript types | separate (@types/wellknown) |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 281 |
| Author | Tom MacWright |
| Maintainers | tmcw |
| Keywords | wkt, geojson, maps |

## Links

- npm: https://www.npmjs.com/package/wellknown
- Repository: https://github.com/mapbox/wellknown
- Homepage: https://github.com/mapbox/wellknown#readme
- Issues: https://github.com/mapbox/wellknown/issues
- npm.io page: https://npm.io/package/wellknown

## Dependencies (2)

- [minimist](https://npm.io/package/minimist.md) ~1.2.0
- [concat-stream](https://npm.io/package/concat-stream.md) ~1.5.0

## 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

- 0.5.0 (latest) — 2016-07-22
- 0.4.2 — 2016-05-10
- 0.4.1 — 2016-02-09
- 0.4.0 — 2015-09-16
- 0.3.4 — 2015-09-11
- 0.3.3 — 2015-09-11
- 0.3.2 — 2015-08-25
- 0.3.1 — 2015-01-03
- 0.3.0 — 2014-10-03
- 0.2.0 — 2014-05-21
- 0.1.3 — 2014-05-19
- 0.1.2 — 2013-10-29
- 0.1.1 — 2013-10-09
- 0.1.0 — 2013-09-10
- 0.0.0 — 2013-09-09

## README

[![Build Status](https://travis-ci.org/mapbox/wellknown.svg?branch=master)](https://travis-ci.org/mapbox/wellknown) [![Coverage Status](https://coveralls.io/repos/mapbox/wellknown/badge.svg)](https://coveralls.io/r/mapbox/wellknown)

# wellknown

Parse & stringify [Well-Known Text](http://en.wikipedia.org/wiki/Well-known_text) into [GeoJSON](http://www.geojson.org/).

Support

* Point + MultiPoint
* LineString + MultiLineString
* Polygon + MultiPolygon
* GeometryCollection
* 2D, 3D, 4D geometries

## cli

install:

    $ npm install -g wellknown

use:

    $ echo "MultiPoint(0 0, 1 1, 3 3)" | wellknown > multipoint.geojson

## usage

this is a node-style module that works in node.js via npm and in browsers via
[browserify](https://github.com/substack/node-browserify) or a standalone package:

**npm install**:

    npm install wellknown

**bower install**:

    bower install wellknown --save

**standalone**:

    wget https://raw.github.com/mapbox/wellknown/master/wellknown.js

## api

### `parse(wkt)`

Given WKT as a string, return a GeoJSON [geometry object](http://geojson.org/geojson-spec.html#geometry-objects)
or `null` if parse fails.

### `stringify(geojson)`

Given a GeoJSON geometry object or Feature object, return a WKT representation
as a string. Throws an error if given a `FeatureCollection` or unknown input.

## example

```js
var parse = require('wellknown');

parse('POINT(1 2)');
```

#### Integrating with Leaflet

```js
// With Leaflet or MapBox.js
var geojsonLayer = L.geoJson(parse('Point(1 2)'));
```

## See Also

* [wicket](https://github.com/arthur-e/Wicket)
* [openlayers wkt](https://github.com/openlayers/openlayers/blob/master/lib/OpenLayers/Format/WKT.js)
* [geomet](https://github.com/geomet/geomet) converts between GeoJSON and WKT in Python

## Rant

The 'WKT Standard' is (mis)managed by the [OGC](http://www.opengeospatial.org/),
and thus is available on page 52 of [this PDF](http://www.opengeospatial.org/standards/sfa).

Given the inaccessibility of the standard, there are no direct reference to it
in this code.

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