# lineChunk

Divides a LineString into chunks of a specified length. If the line is shorter than the segment length then the original line is returned.


参数 类型 描述
geojson (FeatureCollection|Geometry|Feature <(LineString|MultiLineString)>) the lines to split
segmentLength number how long to make each segment
options Object Optional parameters: see below


属性 类型 默认值 描述
units string kilometers units can be degrees, radians, miles, or kilometers
reverse boolean false reverses coordinates to start the first chunked segment at the end


FeatureCollection <LineString> - collection of line segments


var line = turf.lineString([[-95, 40], [-93, 45], [-85, 50]]);

var chunk = turf.lineChunk(line, 15, {units: 'miles'});
Last Updated: 1/19/2021, 10:59:20 AM