# polygonToLine

Converts a Polygon to (Multi)LineString or MultiPolygon to a FeatureCollection of (Multi)LineString.
将多边形转换为(多)线段或将多面体转换为包含(多)线段的FeatureCollection

参数

参数 类型 描述
polygon Feature <(Polygon|MultiPolygon)> Feature to convert
options Object 可选参数:见下文

options选项

属性 类型 默认值 描述
properties Object {} translates GeoJSON properties to Feature

返回

(FeatureCollection|Feature <(LineString|MultiLinestring)>) - converted (Multi)Polygon to (Multi)LineString

示例

var poly = turf.polygon([[
  [125, -30], // 注意:polygon首尾坐标要一致 
  [145, -30], 
  [145, -20], 
  [125, -20], 
  [125, -30]
]]);

var line = turf.polygonToLine(poly);
Last Updated: 7/3/2023, 9:59:14 PM