Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lineOffset returns NaN for some LineStrings #1361

Closed
mllava opened this issue Apr 19, 2018 · 4 comments
Closed

lineOffset returns NaN for some LineStrings #1361

mllava opened this issue Apr 19, 2018 · 4 comments

Comments

@mllava
Copy link

mllava commented Apr 19, 2018

Hi,

I'm having an issue with lineOffset. Please see the example here: https://jsfiddle.net/y4xfzxmx/3/

For the given LineString, lineOffset returns NaN from coordinate 7 onwards, until one before last; even happens with distance = 0. It only happens with a few lineStrings that I'm working with.

Any clue why this could be happening?

Many thanks in advance!
Martin

@rowanwins
Copy link
Member

Hi @mllava

Thanks for the report and the jsfiddle. Unfortunately the lineOffset is a little bit flimsy at the moment and in need of some love (I was blissfully unaware of a few complexities when I started work on it initially). I try and take a look over the next few days and report back my findings, although a proper fix is probably a little while away.

Cheers

@vamshi29292
Copy link
Contributor

The coordinates of the points at 8th and 9th index are identical. What is the expected behaviour in this case? Should the duplicates be removed before processing? (That would make the number of points on the output feature and input feature not equal)

@rowanwins
Copy link
Member

Ah that probably explains it, Thanks for chiming in @vamshi29292 . @turf/clean-coords can be used in this task.

@mllava
Copy link
Author

mllava commented Apr 24, 2018

Well spotted @vamshi29292 ! This flags an issue on my end! Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants