-
Notifications
You must be signed in to change notification settings - Fork 202
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
Update BoundingRect algorithm to return a Result #444
Comments
What should be the behavior if the geometry is invalid? For example, if all the coordinates are NaN values? |
I know that I requested this, but in hindsight, I'm not really sure we should do it after all. To me it seems reasonable that an empty geometry should return an
I've brought this up other places too, and have said we should try to return None rather than a NaN result in some places. But thinking about it a bit more, we do floating point ops all over the place, if we map every NaN to a None we're going to be doing a lot of checking and have very few operations that don't return Options, which sounds tedious. Currently I'm leaning towards just blasting https://www.youtube.com/watch?v=P-jQHQcu1x8 while we close this issue. |
This is both 100% true and also inevitable / our chickens coming home to roost because we've been putting it off for years. |
If we're using |
This is actually far more sensible than my panicked reply (sorry!). FWIW I do think we should collectively think about a coherent strategy for validity at some point, even though nobody wants to. |
So to summarize, to complete this issue, we'll change the signature of |
I glazed over the Is there a meaningful distinction between In my mind the difference between a But when the context we add is literally nil ( Or was And currently nothing exists in the pipeline to produce meaningful errors - e.g. nothing in this code validates. Would it make sense to park this issue for now? |
Yes, effectively I would use I would use But note that I am no authoritative source! I'm just emptying the info in my head, which might be wrong. I tried searching for more discussion about this, and all I found was this reddit thread. Besides that there are many instances of So coming back to this issue, if we were to go with the definition that I laid out, it comes down to whether we expect Ooops that got a little rant-y! I do not at all feel strongly about this, and am curious to hear what others think |
One more thing– Just did some spelunking and found that the |
I love it! I actually fully agree with the well articulated distinction between Result/Option as you've laid it out. Thanks for the references!
This reasoning makes sense to me and I think gets to the core of the matter. "empty geometries are valid" is a hidden assumption that I'd made and FWIW, it seems consistent with the ogc/jts/geos/postgis thinktank: i.e.
|
Well if the thinktank considers it valid, that's good enough for me! Thanks for pointing this out @michaelkirk @b4l, sorry for sending you down that rabbit hole! I think we'll want to leave the trait signatures of |
@frewsxcv no problem! |
I'm not sure I'm understanding, but if you're saying that we should have even infallable methods return a It's usually preferable to have the compiler help you know which cases can't fail rather than having to think about it as a human and sprinkling around potentially crashing If at the callsite you have some reason to turn a |
I believe that in the end, we decided to change nothing here. Variants which can be empty (Geometry, GeometryCollection, Multi*, LineString, Polygon) output So closing this. |
#443 (comment)see the conversation belowThe text was updated successfully, but these errors were encountered: