polygonToLine
描述
¥Description
Converts a 多边形 to (多个)LineString or MultiPolygon to a FeatureCollection of (多个)LineString.
¥Converts a Polygon to (Multi)LineString or MultiPolygon to a FeatureCollection of (Multi)LineString.
参数
¥Parameters
名称 | 类型 | 描述 |
---|---|---|
poly | 特性<多边形 | MultiPolygon> | 要转换的要素 |
options? | 对象 | 可选参数(默认 ) |
options.properties? | 对象 | translates GeoJSON properties to Feature (default ) |
返回
¥Returns
FeatureCollection | 特性<LineString | MultiLinestring> converted (Multi)Polygon to (Multi)LineString
¥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(...);