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