polygonToLine
Description
Converts a Polygon to (Multi)LineString or MultiPolygon to a FeatureCollection of (Multi)LineString.
Parameters
Name | Type | Description |
---|---|---|
poly | Feature<Polygon | MultiPolygon> | Feature to convert |
options? | Object | Optional parameters (default {}) |
options.properties? | Object | translates GeoJSON properties to Feature (default {}) |
Returns
FeatureCollection | Feature<LineString | MultiLinestring> converted (Multi)Polygon to (Multi)LineString
Examples
var poly = turf.polygon([
[
[125, -30],
[145, -30],
[145, -20],
[125, -20],
[125, -30],
],
]);
var line = turf.polygonToLine(poly);
Installation
$ npm install @turf/polygon-to-line
import { polygonToLine } from "@turf/polygon-to-line";
const result = polygonToLine(...);
$ npm install @turf/turf
import * as turf from "@turf/turf";
const result = turf.polygonToLine(...);