[GIS] How to use v.clean in QGIS to fix polygon topology

qgisqgis-grass-plugintopologyv.clean

I have QGIS 3.18 Zurich with GRASS 7.8.5 installed on my 64bit Windows machine. I have digitized 1600+ polygon boundaries that now have sliver polygons, gaps, and overlaps which I've confirmed via the Topology Checker Plugin.

Data are in EPSG 32629 (WGS84 UTM 29N). I've created a key variable FID which was calc'd as @row_number. I am attempting to run v.clean on this data in QGIS with the following parameters:

Input Feature Type = area
Cleaning tools = bpol, rmarea, rmline, rmsa, rmdupl, rmdac
Thresholds = 5,5,5,5,5,5  (this is 5m; I have also tried no thresholds)
Output type = auto
Combine tools with recommended follow-up tools = yes
V.in.ogr snap tolerance = 0.05 (5cm)
v.in.ogr min area = 10.0 (10 sqm, smallest polygon is 11sqm)

However I keep getting blank "Error" and "Cleaned" out puts and receive the following errors in the log:

WARNING: Number of centroids exceeds number of areas: 1619 > 1448
WARNING: Number of incorrect boundaries: 202
WARNING: Number of centroids outside area: 171
ERROR: Key column <> not found
WARNING: Unable to determine input map's vector feature type(s).
WARNING: No attribute table found -> using only category numbers as attributes
WARNING: Output layer is empty, no features written

What am I doing wrong?
Data are here: https://drive.google.com/file/d/1lYIVkftS_XLRF1CQcNsjNI_s5ToegC8w/view?usp=sharing

Best Answer

I first checked your data with Vector > Geometry > Check validity tool in QGIS, which yields a layer of the invalid output and the errors found; all errors where identified as "line 0 contains 1 duplicate node(s) at 0", so I ran the "Remove duplicate vertices" from the processing toolbox and ran again the validity check which gave no errors. Remember to use both QGIS and GEOS algorithms for validity checking. Duplicate vertices occur frequently on hand digitized layers. Furthermore, there's the st_makeValid option in some apps (PostGIS, sf in R, GDAL >3.2, pandas in python) which cleans layers easily most of the time.

Related Question