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


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.

  • 2
    I've also had good luck with the Processing Tools > Vector Geometry > Fix Geometries tool. – Stu Smith Mar 25 at 19:35
  • After your comment I gave a try to Fix geometries but Check validity found invalid output using QGIS's algorithm; manual says: This algorithm attempts to create a valid representation of a given invalid geometry without losing any of the input vertices so apparently it wouldn't delete a vertex – Elio Diaz Mar 25 at 21:36

If you remove the FID column from your layer and then in v.clean>Advanced Parameters change snap tolerance to 10 (or some value greater than 0), v.clean will run through to the end with minimal errors, but the output might not be ideal. In any case, it's the FID column that is causing the issue as v.clean creates an fid column in the output layer.

  • So it's weird because I added the FID column after the fact because I thought the error was because I didn't have a key field to begin with. I got the errors with and without an FID column. I ran Elio's steps of checking validity and was able to remove duplicate vertices which worked. But v.clean still creates an empty output of cleaned results. – BenW Mar 25 at 20:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.