-
Notifications
You must be signed in to change notification settings - Fork 994
include index of MultiLineString geometries in nearest-point-on-line #2574
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
Merged
mfedderly
merged 3 commits into
Turfjs:master
from
andrewharvey:nearest-point-on-line-multi-index
Aug 6, 2024
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 10 additions & 1 deletion
11
...ges/turf-nearest-point-on-line/test/out/expectedLocation - points behind first point.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,10 @@ | ||
| [0, 0, 0, 0, 0, 0, 0, 0] | ||
| [ | ||
| 0, | ||
| 0, | ||
| 0, | ||
| 0, | ||
| 0, | ||
| 0, | ||
| 0, | ||
| 0 | ||
| ] |
7 changes: 6 additions & 1 deletion
7
...turf-nearest-point-on-line/test/out/expectedLocation - points in front of last point.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,6 @@ | ||
| [0.362058, 0.362058, 0.362058, 0.362058] | ||
| [ | ||
| 0.362058, | ||
| 0.362058, | ||
| 0.362058, | ||
| 0.362058 | ||
| ] |
58 changes: 31 additions & 27 deletions
58
packages/turf-nearest-point-on-line/test/out/expectedLocation - points on joints.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,29 +1,33 @@ | ||
| [ | ||
| [0, 0.162908, 0.362058], | ||
| [ | ||
| 0, | ||
| 435.152731, | ||
| 848.38422, | ||
| 1506.62747, | ||
| 1877.71515, | ||
| 2362.640364, | ||
| 2951.524644, | ||
| 3346.548084, | ||
| 3711.226929 | ||
| ], | ||
| [ | ||
| 0, | ||
| 0.011338, | ||
| 0.021306, | ||
| 0.033964, | ||
| 0.057049, | ||
| 0.082838, | ||
| 0.161154, | ||
| 0.207251, | ||
| 0.243733, | ||
| 0.287901, | ||
| 0.320556, | ||
| 0.396017, | ||
| 0.491916 | ||
| ] | ||
| [ | ||
| 0, | ||
| 0.162908, | ||
| 0.362058 | ||
| ], | ||
| [ | ||
| 0, | ||
| 435.152731, | ||
| 848.38422, | ||
| 1506.62747, | ||
| 1877.71515, | ||
| 2362.640364, | ||
| 2951.524644, | ||
| 3346.548084, | ||
| 3711.226929 | ||
| ], | ||
| [ | ||
| 0, | ||
| 0.011338, | ||
| 0.021306, | ||
| 0.033964, | ||
| 0.057049, | ||
| 0.082838, | ||
| 0.161154, | ||
| 0.207251, | ||
| 0.243733, | ||
| 0.287901, | ||
| 0.320556, | ||
| 0.396017, | ||
| 0.491916 | ||
| ] | ||
| ] |
20 changes: 10 additions & 10 deletions
20
packages/turf-nearest-point-on-line/test/out/expectedLocation - points on top of line.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,12 +1,12 @@ | ||
| [ | ||
| 0, | ||
| 0.030566, | ||
| 0.061133, | ||
| 0.091699, | ||
| 0.122265, | ||
| 0.152831, | ||
| 0.183398, | ||
| 0.213964, | ||
| 0.24453, | ||
| 0.275097 | ||
| 0, | ||
| 0.030566, | ||
| 0.061133, | ||
| 0.091699, | ||
| 0.122265, | ||
| 0.152831, | ||
| 0.183398, | ||
| 0.213964, | ||
| 0.24453, | ||
| 0.275097 | ||
| ] |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
should we add the
featureIndextoo since we have it?Uh oh!
There was an error while loading. Please reload this page.
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.
This method is having an identity crisis, it's called
nearestPointOn**Line**(singular) implying it only accepts one line, however the first argument is namedlines(plural) implying it accepts multiple lines, the lines argument type is defined to acceptGeometry|Feature<LineString|MultiLineString>which implies only a single lineFeatureis accepted, albeit you can have aMultiLineStringgeometry within that singleFeature, however it may also accept multiple lines through aGeometryCollectiontype ofGeometry.Checking the implementation it just passes
linesthrough toflattenEachwhich acceptsFeatureCollection | Feature | Geometrythereby giving rise to thefeatureIndex.We should decide that either:
featureIndexor,featureIndexin the result.While officially supporting
FeatureCollectionsounds like a good idea, it gets complicated when thatFeatureCollectioncontains multiple geometry types, and defining how the method behaves in those situations is messy. On the other hand we already supportGeometryCollectionwhich has the same issue. 🤷I think for now we go ahead and just include the
multiFeatureIndexand leave the decision onfeatureIndexto another discussion/issue/PR.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.
Fair points, thanks for the detailed writeup!