-
Notifications
You must be signed in to change notification settings - Fork 199
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
Implement validity checks for each geometry type #127
Comments
Relevant: #56 |
Something I'm working on appears to require valid geometries, so I'm interested in this. I'd be half tempted to implement what I want as a starting point sometime. |
i have a WIP PR for ensuring valid linestrings: https://github.com/georust/rust-geo/pull/155/files?w=1 if you have any feedback, let me know |
Looks like it solves one case, but there are many ways for a linestring to be invalid, and I hit an odd one (a linestring of 2 identical points!). However that link from PostGIS splits things 2 ways. Simple, and Valid. In it, there are no invalid linestrings (so long as there's >=2 points). So maybe It's worth adding simplicity check? Or call do a simple & valid check but call that "validity" (my preferred option)? |
for what it's worth, i'm in favor of making validity opt-out. if i have a yeah, i knew about the 'no duplicate points' simplicity rule for linestrings, but wasn't sure the best way to address it. logically, it's a pretty straightforward check, but i'm not sure how best to implement it since it could affect performance. for example, if we kept a |
I also haven't thought about it too much. I think validity should be opt-out too. Sometimes you don't care, or more importantly, you can assume (or know) that the thing is valid, in which case there shouldn't be a performance hit. |
I agree about optional validity. I really like the idea of validity checks being easily chainable, so you could e.g. carry out a series of "cheap" geo operations, only checking validity before a potentially expensive one, and bailing out with an Err if need be. |
Just opened a new pull request adding a If any of you have some time, would love to get some 👀 and opinions |
See discussion in #123
Validity checks are described here: https://postgis.net/docs/using_postgis_dbmanagement.html#OGC_Validity
e.g.
Point::is_simple
,LineString::is_simple
, etc.The text was updated successfully, but these errors were encountered: