-
Notifications
You must be signed in to change notification settings - Fork 40
feat(rust/sedona-geos): Implement ST_LineMerge() #503
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
paleolimbot
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!
Did you want to add a Python integration test for this here? (I can also file a follow-up issue so we don't forget)
| # Note that the behaviour on non-multilinestring geometry is not documented. | ||
| # But, we test such cases here as well to detect if there's any difference. | ||
| ("POINT (0 0)", "GEOMETRYCOLLECTION EMPTY"), | ||
| ("LINESTRING (0 0, 1 0)", "LINESTRING (0 0, 1 0)"), | ||
| ("POLYGON ((0 0, 0 1, 1 0, 0 0))", "LINESTRING (0 0, 0 1, 1 0, 0 0)"), |
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.
interesting. The docs say "Other geometry types return an empty GeometryCollection" in the note. Though that doesn't seem to be the case for POLYGON or LINESTRING input 🤷.
Could we test some empty geometries, for both of these tests? Those can often catch weird edge cases.
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.
Thanks for catching. I simply didn't notice the note...
I'll add empty cases.
Do you mean benchmark tests? I just forgot to do so, but now I don't immediately see how to add tests as it probably requires specific inputs of touching line segments. |
Co-authored-by: Peter Nguyen <[email protected]>
petern48
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.
(I will leave this for @paleolimbot to clarify what he meant and answer this: #503 (comment), given there were python integration tests already).
This reverts commit 9ab729c.
paleolimbot
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.
One thing to note is that, the direction-aware version (.line_merge_directed()) requires GEOS >= v3.11
I think our current minimum is 3.12 (for M coordinates), so this is no problem. We could try harder to support older GEOS with some feature flags or defines if this comes up.
Did you want to add a Python integration test for this here?
That was just me reviewing too fast 🤦 . Sorry!
|
I see. Thanks for clarifying! |
This pull request implements
ST_LineMerge.https://postgis.net/docs/en/ST_LineMerge.html
This is mostly straightforward using GEOS's LineMerge via the geos crate. One thing to note is that, the direction-aware version (
.line_merge_directed()) requires GEOS >= v3.11, which was released 3.5 years ago. I don't think this is a difficult requirement, but I'm not really sure.https://github.com/georust/geos/blob/47afbad2483e489911ddb456417808340e9342c3/src/geometry.rs#L2796-L2802