polygonToLine
描述
🌐 Description
将 Polygon 转换为 (Multi)LineString 或将 MultiPolygon 转换为 (Multi)LineString 的 FeatureCollection。
🌐 Converts a Polygon to (Multi)LineString or MultiPolygon to a FeatureCollection of (Multi)LineString.
参数
🌐 Parameters
| 名称 | 类型 | 描述 |
|---|---|---|
| poly | Feature<Polygon | MultiPolygon> | 转换功能 |
| options? | Object | 可选参数 (默认 {}) |
| options.properties? | Object | 将 GeoJSON 属性转换为 Feature (默认 {}) |
返回
🌐 Returns
FeatureCollection | Feature<LineString | MultiLinestring> 已将 (多)多边形转换为 (多)线串
示例
🌐 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(...);