Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign up@turf/along throws an "Coord is required" error #1802
Labels
Comments
|
Hi @noway It's pretty tricky to debug with seeing some data... I've tried a few things but can't replicate, if you can supply a sample input then we can look at it further |
|
@rowanwins finally reproduced!!! along({ "type": "Feature", "properties": {}, "geometry": {"type": "LineString", "coordinates": [[174, -36], [174.1, -36.1] ] } }, -0.1, { units: 'kilometers' })happens when second argument is negative!!! |
|
@rowanwins I fixed the bug in my own code, just had to replace I think a line of warning in the reference docs would be sufficient to put this issue to rest! |
|
Thanks for reporting back @noway ! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment


@turf/along throws this https://github.com/Turfjs/turf/blob/master/packages/turf-invariant/index.ts#L18 error.
My usage:
Error/stacktrace:


My debugging. Note that
coords[i - 1]is undefined.Unfortunately I don't have GeoJSON data file. The issue is intermittent and only happens for some arcane GPS stream values. I pinpointed issue to
coords[i - 1]being undefined, but I don't know why it could be undefined because I don't understand the algorithmalongfunction uses.