0.5.0 • Published 8 years ago

wellknown v0.5.0

Weekly downloads
18,327
License
BSD
Repository
github
Last release
8 years ago

Build Status Coverage Status

wellknown

Parse & stringify Well-Known Text into GeoJSON.

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

var parse = require('wellknown');

parse('POINT(1 2)');

Integrating with Leaflet

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

See Also

Rant

The 'WKT Standard' is (mis)managed by the OGC, and thus is available on page 52 of this PDF.

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

@directus-asolole/api@elecerp/directus-extension-energysee-moduledirectus9-lite@triply/triply-node-utilsmakeMapsdimensio@infinitebrahmanuniverse/nolb-wel@everything-registry/sub-chunk-3140wkt-langdbgate-webdpayoamsehh-gisnode-red-contrib-snap4city-usernode-red-contrib-snap4city-d3-dashboard-widgetsmv-data-coremv-data-core-alpha-buildtile-makermysql2geojsonng-ansynnysp2webmercol-gis-projectcoalesce-componentscsv-wkt-linktruekepler.glmymap.gl@metachain/api@mapbox/leaflet-omnivore@seventty/leaflet-x@planet/importer@shitao1988/swsk-kepler-gl@shitao1988/swsk.kepler.gl@new-mv-datacore/api@orbitgtbelgium/nebula-map-toolsyasgui-yasrgeojsonify@mnemotix/weever-core@nebula.gl/editor@sebf/kepler.glerasme-kepler.glorbit-map-toolsorbit-nebula-draw-toolsorbit-nebula-editororbit-test-nebula.gl-editorwikidata-query-guifiziico-test@jonas.tang/mgcc-dms-apiwkt-parser-helperwkb2geojson@mapbox/pt2itp@khang00/kepler.glheremap@ttungbmt/leaflet-sourcewael-libfences-builderfatstrawpelias-openstreetmap-polygons@interactivethings/visualize-appramesh-paul-kepler.glquantum_directus_apipt2itpqwc2global-resolvers-tagsplannerjs@jgaehring/field-kitwise-map@imagesat/map-apipostgis-preview@kalisio/kfs@skuhnow/directus@tommy2gis/geo-editor@tommy2gis/swsk.kepler.gljmap-core-jsjmapcloud-ng-corejmapserver-ng-coresequelize-mysql-set-timezone-fixsequelize-sszsequelizepg@arc-directus/apikepler.gl-forked-ismakutlkepler.gl.geoiqkepler.gl.sh.customkritekrite-vueleaflet-omnivoreleaflet-better-filelayer@cnds/ds-d3corearlas-web-contributorsarlas-web-componentsarlas-web-contirbutors@wsw0108/to-geojson@varlab-ucf/nebulagl-editor@synqueit/derpidris-csv@superscribe/api@tahosa/sequelize@afetcan/storage@wbce-d9/api@42dot/maps-platform-js@aclisp/directus@acildeprem/storage
0.5.0

8 years ago

0.4.2

8 years ago

0.4.1

8 years ago

0.4.0

9 years ago

0.3.4

9 years ago

0.3.3

9 years ago

0.3.2

9 years ago

0.3.1

9 years ago

0.3.0

10 years ago

0.2.0

10 years ago

0.1.3

10 years ago

0.1.2

10 years ago

0.1.1

11 years ago

0.1.0

11 years ago

0.0.0

11 years ago