Appearance
KBE3D / KBCore / turf / lineChunk
函数: lineChunk()
lineChunk<
T>(geojson:GeometryCollection<Geometry> |T|Feature<T,GeoJsonProperties> |FeatureCollection<T,GeoJsonProperties> |Feature<GeometryCollection<Geometry>,GeoJsonProperties>,segmentLength:number,options?: {units?:Units;reverse?:boolean; }):FeatureCollection<LineString>
Function
Divides a LineString into chunks of a specified length. If the line is shorter than the segment length then the original line is returned.
类型参数
T
T extends LineString | MultiLineString
参数
geojson
the lines to split
GeometryCollection<Geometry> | T | Feature<T, GeoJsonProperties> | FeatureCollection<T, GeoJsonProperties> | Feature<GeometryCollection<Geometry>, GeoJsonProperties>
segmentLength
number
how long to make each segment
options?
Optional parameters
units?
Supports all valid Turf Units
reverse?
boolean
reverses coordinates to start the first chunked segment at the end
返回
collection of line segments
示例
ts
var line = turf.lineString([[-95, 40], [-93, 45], [-85, 50]]);
var chunk = turf.lineChunk(line, 15, {units: 'miles'});
//addToMap
var addToMap = [chunk];