Appearance
KBE3D / KBCore / turf / lineSegment
函数: lineSegment()
lineSegment<
G>(geojson:G|Feature<G,GeoJsonProperties> |FeatureCollection<G,GeoJsonProperties>):FeatureCollection<LineString>
Function
Creates a FeatureCollection of 2-vertex LineString segments from a (Multi)LineString or (Multi)Polygon.
类型参数
G
G extends LineString | MultiLineString | Polygon | MultiPolygon
参数
geojson
GeoJSON Polygon or LineString
G | Feature<G, GeoJsonProperties> | FeatureCollection<G, GeoJsonProperties>
返回
2-vertex line segments
示例
ts
var polygon = turf.polygon([[[-50, 5], [-40, -10], [-50, -10], [-40, 5], [-50, 5]]]);
var segments = turf.lineSegment(polygon);
//addToMap
var addToMap = [polygon, segments]