Commit
Fail if invalid geometries are found. And some easy performance wins. Just because. Fix #11986
- Loading branch information
There are no files selected for viewing
8 comments
on commit 5ae0e78
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.
Touching base for an earlier discussion w.r.t "fail-fast" algorithms. This commit outlines the way I think it should be handled.
- Check for NULL geometries
- By default error out
- Unless the user checked "Ignore NULL geometries"
- Check for invalid geometries
- Error out. I'd like to tweak the wording to give the user hints what he could do to fix the geometries. Any hints?
If you are ok with this, it could be put into some utils library to avoid copying / pasting it a million times around.
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 approach means it's impossible to keep null geometries. I think ignoring should instead copy the feature without geometry to the output layer. Then you'd either be explicitly strip them out in adjacent (with a new algorithm for this purpose) or copying them unchanged.
I thought you were thinking of making this a global processing option too?
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.
That's right, NULL geometries will disappear. My approach was to extend SQL logic where NULL != NULL
. We could as well copy any NULL geometries from both layers to the result. Or the cartesian product of combining every NULL entry with every entry from the other layer.
For this commit, the main goal was to fixup invalid geometry problems and not yet the ultimate solution to all. That will hopefully be in QGIS 3 after this discussion here ;)
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.
That's fine... I actually didn't even think through the full implications of this for intersects. So I agree - intersects should skip null geometries, and it never makes sense to copy them.
My thoughts:
- routines which operate on a geometry - eg buffer, etc should be able to copy null geometries intact
- routines which do some type of spatial filtering eg selection by location, this intersection alg, should skip over null geometry features
So ignore my original comment, this seems like the right approach until we move that setting to a global property.
Should we quickly make a "strip null geometry" alg before release?
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.
@m-kuhn , shouldn't the same be applied to other vector overlay operations?
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.
My thoughts:
- routines which operate on a geometry - eg buffer, etc should be able to copy null geometries intact
- routines which do some type of spatial filtering eg selection by location, this intersection alg, should skip over null geometry features
that sounds like a good approach 👍 , although not sure about the select by location, I think that one could offer a checkbox to decide what to do with nulls
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.
@m-kuhn , shouldn't the same be applied to other vector overlay operations?
yes!
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.
routines which do some type of spatial filtering eg selection by location, this intersection alg, should skip over null geometry features
Yet another situation: I think for the Union algorithm it makes sense to copy the features to the target layer.
How would this be possible? If it has no geometry it wouldn't be in the intersects list in the first place...