-
Notifications
You must be signed in to change notification settings - Fork 30
Implement ST_IsValidReason using geos library #230
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
| None, | ||
| Some("POLYGON ((0 0, 0 1, 1 1, 1 0, 0 0))"), | ||
| Some("POLYGON ((0 0, 1 1, 0 1, 1 0, 0 0))"), | ||
| Some("LINESTRING (0 0, 1 1)"), |
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.
| Some("LINESTRING (0 0, 1 1)"), | |
| Some("LINESTRING (0 0, 1 1)"), | |
| Some("Polygon((0 0, 2 0, 1 1, 2 2, 0 2, 1 1, 0 0))"), |
Let's add this case, since it's a type of reason we haven't included yet. On PostGIS, it returns Ring Self-intersection
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.
Yeah, true!
| &f, | ||
| "geos", | ||
| "st_isvalidreason", | ||
| ArrayScalar(Polygon(10), Polygon(10)), |
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.
| ArrayScalar(Polygon(10), Polygon(10)), | |
| Polygon(10), |
These are like arguments to the function, since is_valid only takes one geometry, the value here is just a single Polygon. You can see st_centroid above as an example. This should fix the CI failure.
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.
Correctly So, I've adjusted accordingly!
| &f, | ||
| "geos", | ||
| "st_isvalidreason", | ||
| ArrayScalar(Polygon(10), Polygon(500)), |
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.
| ArrayScalar(Polygon(10), Polygon(500)), | |
| Polygon(500), |
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 once again!
|
@paleolimbot I noticed Also, I realize we should probably be implementing function stubs too, right? (for my one curiosity) Do they serve any extra purpose other than documentation? |
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!
Do we want to implement the [ ] part? I personally don't mind leaving the [ ] part for a separate later issue if we want it, since I'm not sure how simple it would be to implement that off the top of my head.
I agree we can't do this for now because is_valid_detail() is not exposed in the Rust GEOS crate. For what it's worth, the relevant GEOS function is:
...and where it would go in the geos crate is:
Also, I realize we should probably be implementing function stubs too, right? (for my one curiosity) Do they serve any extra purpose other than documentation?
The main purpose is documentation and possibly to help interfaces generate logical plans (since stubs can compute an output type from input types). We haven't quite set that up yet and so I don't think function implementation PRs need to handle it just yet 🙂
|
Sorry @Abeeujah, looks like we have merge conflicts again, could you resolve them? While doing so, could you also re-order the code in the following files, so they are all in alphabetical order? I didn't notice you've been putting them all at the bottom.
Make sure you merge with |
|
I should've been clearer: I just meant reorder the functions you implemented recently (ie. what you did for I didn't mean to come off as the ordering is super strict (it's not). I'd guess none of the files are in the exact same order. As an FYI, they do typically tend to be in a sort of grouped alphabetical order (see this register.rs to see this visually). My main point is 1) you don't need to put them all at the bottom but also 2) don't stress about the ordering. Just place it where ever in the file that makes sense to you. It's unrealistic for reviewers to check and enforce a strict ordering. My main intention was to give you a heads-up for any future PRs that there is some (rough) ordering in these files, and following it can help avoid merge conflicts, which helps Dewey merge them faster. |
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! (And apologies I lost track of the approval to merge)
Peter is correct...I do usually alphabetize things because I've been doing this for a while and it can help prevent merge conflicts, but also I usually don't make people do this when I review except as a side note.
|
@petern48 It's fine actually, I should have paid more attention to details, I definitely would in future PRs 👍 |
This pull request references the discussions had in #224