Please sign in to comment.
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FEATURE] Optimise processing clip algorithm
Before the algorithm was written to optimise clipping a few features against thousands of mask features. The revised algorithm is optimised for clipping thousands of input features against a few mask features. Given that this second operation is much more likely, it makes sense to optimise for this use case. I've also applied some other optimisations like taking advantage of spatial indexes on the providers, using prepared geometries and also only applying an intersection operation if the geometry isn't wholly contained by the mask geometry. Benchmarks: clipping roads layer with 1 million lines against 2 polygons before: 5 mins 30 seconds after: 10 seconds clipping address layer with 5 million points against 2 polygons before: 50 minutes after: 30 seconds (cherry-picked from 71ebdb8)
- Loading branch information
Showing with 79 additions and 68 deletions.
- +74 −63 python/plugins/processing/algs/qgis/Clip.py
- +1 −1 python/plugins/processing/tests/testdata/expected/clip_lines_by_multipolygon.gml
- +2 −2 python/plugins/processing/tests/testdata/expected/clip_multipolygons_by_polygons.gml
- +2 −2 python/plugins/processing/tests/testdata/expected/clip_polys_by_multipolygon.gml