wkt-io-ts
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

wkt-io-ts - validates, encodes, and decodes between GeoJSON and WKT strings

License npm Build Status GitHub last commit codecov Dependabot Status DeepScan grade Code Style: Google npm bundle size semantic-release

Quick Start

After yarn add wkt-io-ts fp-ts:

import { GeometryFromWKTString, WKTStringFromGeometry } from 'wkt-io-ts';
import { isRight } from 'fp-ts/lib/Either';
 
const maybeWkt = 'LINESTRING (29.3 -5, 13 30, 50 32)';
const maybeGJ = GeometryFromWKTString.decode(maybeWkt);
if (!isRight(maybeGJ)) {
  // did not validate as WKT
  throw new Error();
}
// geojson
console.log(maybeGJ.right);
 
const outWkt = WKTStringFromGeometry.decode(maybeGJ.right);
if (!isRight(outWkt)) {
  // did not validate as GeoJSON
  throw new Error();
}
// wkt
console.log(outWkt.right);

License

Read the LICENSE for details.
The entire NOTICE file serves as the NOTICE that must be included under Section 4d of the License.


# wkt-io-ts

This product contains software originally developed by Holvonix LLC.
Original Repository: https://github.com/holvonix-open/wkt-io-ts

Copyright (c) 2019 Holvonix LLC. All rights reserved.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this software except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Dependencies may have their own licenses.

Package Sidebar

Install

npm i wkt-io-ts

Weekly Downloads

6

Version

1.0.2

License

Apache-2.0

Unpacked Size

28.9 kB

Total Files

9

Last publish

Collaborators

  • holvonix-bot