turf-line-chunk
Divide a linestring into chunks of a specified length
turf.line-chunk(line, segment_length, units)
Divides a LineString into chunks of a specified length.
Parameters
parameter | type | description |
---|---|---|
line |
Feature.<LineString> | the line to split |
segment_length |
Number | how long to make each segment |
units |
String | can be degrees, radians, miles, or kilometers |
Example
var line = "type": "Feature" "properties": {} "geometry": "type": "LineString" "coordinates": -8628524780273438 40250184183819854 -8598587036132812 4017887331434696 -8597213745117188 4008857859823707 -8577987670898438 4015578608609647 ; //=line var result = turf; resultfeatures; //=result
Returns FeatureCollection.<LineString>
, collection of line segments
Installation
Requires nodejs.
$ npm install turf-line-chunk
Tests
$ npm test