Bug report #10338
inverted polygon symbology wrongly handles overlapping polygons
|Affected QGIS version:||master||Regression?:||No|
|Operating System:||Easy fix?:||No|
|Pull Request or Patch supplied:||Yes||Resolution:|
|Crashes QGIS or corrupts data:||No||Copied to github as #:||18759|
Right now, the inverted polygon symbology appears to add polygons using a symmetrical difference method, resulting in a mishandling of overlapping polygons.
Basically right now when polygons overlap, the overlapping area is covered by symbology (i.e. considered as having no polygon underneath it). Overlapping polygons should result in merged area that isn't filled by the inverted polygon symbology.
See attached project, easier to understand through looking at it :)
Flagging this as blocker as IMO this needs fixing before releasing the feature to the public.
#1 Updated by Hugo Mercier over 6 years ago
No particular spatial operations are done on the polygons. They are only surrounded by a big square polygon. The 'inversion' effect is done by the rendering pipeline, through QPainter operations. It is by default using the even-odd filling rule, which explains what you see.
The other rule (non-zero winding) could resolve the issue, but if and only if we send polygons to the QPainter pipeline with consistent orientations (exterior rings always in the same orientation - cw or ccw).
An alternative would be to add a spatial operation of merging, but from what I already tested, it was very slow and too strict (what to do when geometries are invalid ?) when using GEOS-based primitives.
#3 Updated by Hugo Mercier over 6 years ago
Ok, after some experiments with QPainter, it appears the filling rules won't solve this problem easily.
So I think you would have to rely on some spatial preprocessing (union).
I would prefer to have this as an option, since it requires some computations and may return blank polygons when the union is not doable (when the input polygons are invalid are when the on-the-fly simplification gives invalid polygons).