-
Notifications
You must be signed in to change notification settings - Fork 993
Fixed a bug in nearestPointOnLine causing duplicate points to be returned from lineSlice #2951
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
Conversation
sometimes refer to a non-existent line string segment. This was having a flow on effect in lineSlice where an additional duplicate point would be added as a result.
mfedderly
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thank you!
|
@smallsaucepan @mfedderly Hi, I hope you are doing well. I just wanted to let you know that the change made in this PR broke my code and gave me quite a headache. 😅 I was really looking forward to using the new turf 7.3.2 version because it included my new nearestPointOnLine properties from #2867. You can imagine my frustration when the upgrade broke my code and I realized that it's because the new version also includes this unexpected change. It's obviously not a huge problem and I have since implemented a workaround. But I would appreciate it very much if this special case could be handled better by turf itself. I understand that this change was made to fix a problem in the lineSlice function. And after thinking about it for some time, I also agree that it makes sense that the maximum possible value for the However, large parts of my code relied on the previous behavior, and regardless of which behavior you prefer, I hope you agree that the nearest point falling on the last point of the line is a special case that should be handled accordingly. I therefore propose to add a boolean property to the point returned by the nearestPointOnLine function that is true if and only if the nearest point exactly falls on the last point of the input line. We could name it If you give the green light on my proposal (or have a better idea), I would be happy to make a pull request. |
|
@EmilJunker would you mind raising a seperate issue on this, and include some example geometries? What used to work but doesn't now? Refer to this PR and we'll take a look right away, and weigh up the options (including rolling this change back). Thank you and sorry it took the enjoyment out of using those new properties. |
…y PR Turfjs#2951, while still keeping lineSlice issue Turfjs#2946 resolved with a temporary workaround.
Fixed a bug in nearestPointOnLine where index of returned point would sometimes refer to a non-existent line string segment. This was having a flow on effect in lineSlice where an additional duplicate point would be added as a result.
Fix adds a check to make sure nearestPointOnLine isn't returning the index of a line segment that doesn't exist.
Resolves #2946