Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix performance issue when splitting polygons (fixes #34326)
Using test data with a HUGE polygon with several hundreds of thousands of vertices and nearly a thousand of holes, split geometry was taking really long time. On my laptop ~67 seconds for a simple split line. With this fix, the time went down to ~10 seconds for the test polygon. The issue was that split tool was doing an expensive exact intersection calculation for each polygon part returned from polygonize, and then calculating areas to see whether the original polygon part and intersected part were more or less the same. I think that can be replaced by a much simpler point in polygon test to figure out whether the particular polygon part from polygonize is falls inside the original geometry or whether it falls into a hole or exterior. In my tests the time could be further improved to ~3 seconds by disabling mergeGeometriesMultiTypeSplit() function - it is a bit of a mistery to me what problem does it solve, however it has N^2 running time with N being number of rings - but I did not feel adventurous enough to poke into it. (mainly because there are no unit tests that would verify its behavior) (cherry picked from commit 00a102c) (cherry picked from commit b75ba12)
- Loading branch information