Skip to main content
Version: 7.3.0

polygonToLine

描述

🌐 Description

Polygon 转换为 (Multi)LineString 或将 MultiPolygon 转换为 (Multi)LineStringFeatureCollection

🌐 Converts a Polygon to (Multi)LineString or MultiPolygon to a FeatureCollection of (Multi)LineString.

参数

🌐 Parameters

名称类型描述
polyFeature<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(...);