Document nearestPointOnLine behaviour for v8 #3022
Replies: 5 comments 9 replies
-
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
Then this is probably why it was coded that way in the first place. In light of what seems like a useful, real world convention we can just leave that behaviour as is. If the point can be on the either segment, Turf will continue to indicate the segment most likely to be used "next". What will still be fixed (this issue) is the segmentIndex pointing beyond the end of the lineString to a non-existent segment. Will update the description to reflect that. |
Beta Was this translation helpful? Give feedback.
-
|
First of all, thank you for the swift handling of the regression, I just saw that v7.3.4 was released yesterday. I appreciate it 🙏
Please not that again, this was the behavior in v7.3.2 and it broke the symbiosis (sorry, I just can't think of a better word) between the lineStringIndex and segmentIndex that I've been writing about so much. Maybe this overview will help to make it clear:
|
Beta Was this translation helpful? Give feedback.
-
|
You'll need to explain more what you mean by "symbiosis". I'm not following. Perhaps a couple of labelled diagrams to illustrate the relationship. |
Beta Was this translation helpful? Give feedback.

Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Discussion to document from the ground up the behaviour of nearestPointOnLine for the next major release.
Function purpose: given a MultiLineString and a Point, identify the closed point on the input line to the input point.
Inputs:
LineString | MultiLineString | Feature<LineString | MultiLineString>Point | Feature<Point>{...}Returns:
In addition to the position of the nearest point, for convenience the function returns some meta data about where in the input line the point was found. For example, on which segment of which LineString the point was found on.
In the case of ambiguity, such as when the nearest point lies on multiple line segments, the behaviour will be:
Beta Was this translation helpful? Give feedback.
All reactions