Skip to content

Instantly share code, notes, and snippets.

@morganherlocker
Created July 15, 2015 21:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save morganherlocker/6ec78057083752d2f35d to your computer and use it in GitHub Desktop.
Save morganherlocker/6ec78057083752d2f35d to your computer and use it in GitHub Desktop.
var line = {
"type": "Feature",
"properties": {},
"geometry": {
"type": "LineString",
"coordinates": [
[
-83.13431739807127,
40.59414233212419
],
[
-83.12792301177979,
40.59376757776094
],
[
-83.12599182128906,
40.5902317484185
],
[
-83.12730073928833,
40.58930295117977
],
[
-83.12790155410767,
40.5866957321084
],
[
-83.12416791915894,
40.584267667946634
],
[
-83.12745094299316,
40.58312693622952
],
[
-83.1232237815857,
40.57789561733777
],
[
-83.12702178955078,
40.57716222218102
]
]
}
}
var increment = 0.25
var units = 'miles'
var distance = turf.lineDistance(line, units)
var traversed = 0
var pts = turf.featurecollection([])
while(traversed < distance){
traversed += increment
if(traversed <= distance){
pts.features.push(turf.along(line, traversed, units))
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment