qgis / QGIS

QGIS is a free, open source, cross platform (lin/win/mac) geographical information system (GIS)
https://qgis.org
GNU General Public License v2.0
10.46k stars 2.99k forks source link

Check geometries cannot be used to fix overlaps and gaps #34664

Open uclaros opened 4 years ago

uclaros commented 4 years ago

Describe the bug The Check Geometries c++ plugin cannot be used to fix overlaps and gaps. When fixing overlaps, I get a Error is obsolete, but rerunning the check shows that it is still there. overlap

When fixing gaps, selecting the Create new feature resolution leads to a Fixed failed: Could not add feature. Selecting one of the two Add to ... resolutions fills the gap but the tool thinks more gaps were created! Fixing those will create overlaps. Ignoring those and rerunning the check shows that they were fixed. gap (the error that pops on the background is irrelevant, Qt : QXcbConnection: XCB error: 3 (BadWindow), sequence: 15348, resource id: 35770697, major code: 40 (TranslateCoords), minor code: 0, but I do get a CRITICAL Layer check_geom : Field 0 of feature 500 doesn't exist. on the Messages Log)

How to Reproduce -Run Check Geometries with Check for overlaps and Check for gaps with some big area value on the attached layer. -Click fix on the errors check_geom.gpkg.zip

QGIS and OS versions Master on Debian

Additional context I had similar experiences with gaps using the Topology Checker and the Layer properties>Digitizing>Topology Checks>Gaps option. Could be the same as #23187 and #23188 from QGIS 2? Could also be the same as #29556

gioman commented 4 years ago

@uclaros it seems similar to https://github.com/qgis/QGIS/issues/23187

@manisandro

uclaros commented 4 years ago

In the case of new gaps found after fixing an error, the reason is flawed logic in the recheck mechanism. When an error is fixed, an mbr of the affected area is calculated and all features intersecting it are rechecked. If you have features with inner rings (holes) that intersect the mbr but their inner rings don't, then they are identified as gaps because other features that cover the holes do not take part in the recheck.

gioman commented 11 months ago

After 3.5 years I can pretty much still confirm this report, especially for gaps that rarely are fixed rendering the whole experience very frustrating especially considering that the processing "snap to..." tools can fix this problems but there is no (as far as I know) tool there that can check for those errors showing them on map (and Topology checker does not fix errors).

Back to geometry checker and gaps, choosing to fix the problem with "add to longest shared edge" or "add to largest neighboring area" returns most of the times a "failed to merge with neighbor" error, without saying why (and nothing in QGIS logs).

Choosing "create new feature" (creating tiny polygons that could be removed with other tools in a second step) always fails in "could not add feature".

And even when some gap is fixed the resulting report is very confusing

image

Even more baffling are cases where gaps are not detected at all:

image

Since long ago I'm a supporter (and available to co-fund the effort) of the idea of merging the geometry checker and topology checker: both names are confusing as both do geometry and topology checks, and while the topology checker is much more user friendly it does not fix anything. But as can see here the geometry checker has quite a few shortcomings of its own.

gioman commented 11 months ago

This is "fun". Check a layer for gaps (and "modify input layer" active), finds 10 gaps

image

choose to fix them with the default resolution

image

5 fixed, 2 not fixed, 6 new.... should give 13, but it says that are 12 (and by the way, what obsolete errors are?).

So run it again, same identical parameters:

image

it finds again 10 erros... and the cycle continues....