turf-line-to-polygon
v0.2.1
Published
A turf module to transform a LineString geometry to a (closed) Polygon geometry.
Downloads
147
Readme
turf-line-to-polygon
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 ] ] ]
}
}