0.2.1 • Published 9 years ago

turf-line-to-polygon v0.2.1

Weekly downloads
80
License
ISC
Repository
github
Last release
9 years ago

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