Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@terraformer/wkt

Package Overview
Dependencies
Maintainers
4
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@terraformer/wkt

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

  • 2.2.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
18K
increased by17.85%
Maintainers
4
Weekly downloads
 
Created
Source

@terraformer/wkt

npm travis standard

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

Install

npm install @terraformer/wkt

API Reference

Terraformer

Terraformer.wktToGeoJSON(WKT) ⇒ object

Converts a WKT geometry into a GeoJSON geometry.

Kind: static method of Terraformer
Returns: object - GeoJSON.

import { wktToGeoJSON } from "@terraformer/wkt"

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

>> { "type": "Point", "coordinates": [ -122.6764, 45.5165 ] }
ParamTypeDescription
WKTstringThe input WKT geometry.

Terraformer.geojsonToWKT(GeoJSON) ⇒ string

Converts a GeoJSON geometry or GeometryCollection into a WKT string.

Kind: static method of Terraformer
Returns: string - WKT.

import { geojsonToWKT } from "@terraformer/wkt"

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

geojsonToWKT(geojsonPoint)

>> "POINT (-122.6764 45.5165)"
ParamTypeDescription
GeoJSONobjectThe input GeoJSON geometry or GeometryCollection.

Usage

Browser (from CDN)

This package is distributed as a UMD module and can also be used in AMD based systems or as a global under the Terraformer namespace.

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

Node.js

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

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

ES module in the browser

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

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

Contributing

LICENSE

Keywords

FAQs

Package last updated on 15 May 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc