Appearance
KBE3D / KBCore / turf / polygonToLine
函数: polygonToLine()
polygonToLine<
G,P>(poly:G|Feature<G,P>,options?: {properties?:any; }):Feature<LineString|MultiLineString,P> |FeatureCollection<LineString|MultiLineString,P>
Function
Converts a Polygon to (Multi)LineString or MultiPolygon to a FeatureCollection of (Multi)LineString.
类型参数
G
G extends Polygon | MultiPolygon
P
P extends GeoJsonProperties = GeoJsonProperties
参数
poly
Feature to convert
G | Feature<G, P>
options?
Optional parameters
properties?
any
translates GeoJSON properties to Feature
返回
Feature<LineString | MultiLineString, P> | FeatureCollection<LineString | MultiLineString, P>
converted (Multi)Polygon to (Multi)LineString
示例
ts
var poly = turf.polygon([[[125, -30], [145, -30], [145, -20], [125, -20], [125, -30]]]);
var line = turf.polygonToLine(poly);
//addToMap
var addToMap = [line];