turf-line-to-polygon

0.2.1 • Public • Published

turf-line-to-polygon

Build Status

Transforms a LineString geometry to a (closed) Polygon geometry.

Usage

var lineToPolygon = require('turf-line-to-polygon');

var lineFeature = {
  "type": "Feature",
  "properties": {},
  "geometry": {
    "type": "LineString",
    "coordinates": [ [ 0,0 ], [ 0,1 ], [ 1,1 ], [ 1,0 ] ]
  }
};

var polyFeature = lineToPolygon(lineFeature);

Returns:

{
  "type": "Feature",
  "properties": {},
  "geometry": {
    "type": "Polygon",
    "coordinates": [ [ [ 0,0 ], [ 0,1 ], [ 1,1 ], [ 1,0 ], [ 0,0 ] ] ]
  }
}

/turf-line-to-polygon/

    Package Sidebar

    Install

    npm i turf-line-to-polygon

    Weekly Downloads

    23

    Version

    0.2.1

    License

    ISC

    Last publish

    Collaborators

    • cspanring
    • morganherlocker