[GIS] Fixing polygon self-intersection in QGIS

polygonqgis-2self-intersection

I am attempting to mask a raster to US Forest Service boundaries in QGIS. It fails due to self – intersections of polygons.

Warning 1: Ring Self-intersection at or near point -109.90112962000001 43.649977879999994
ERROR 1: Cutline polygon is invalid.

I have run the check validity tool and a new shapefile is created but it too finds the same error when attempting to mask the raster to the "valid" shapefile.

I have also attempted to dive into the v.clean tool with unsuccessful results using both bpol and snap separately. I don't fully understand what this tool is doing, but it outputs a number of polygons that match some Forest Service land but excludes the majority of their land.

I also ran v.build.check to find topological errors and it created an output that is seemingly empty. Nothing in the attribute table, nothing visible on the map.

There have been similar questions on here but I haven't been able to make their solutions work.

I downloaded and used GRASS to attempt to fix the self-intersecting polygons. GRASS upon v.in.ogr recommended I snap at 1e-6. I did this and the output said I had 1 area overlapping left when previously I had thousands. So I saved the shapefile and imported to QGIS to being my analysis over there. The check validity tool found 185 self-intersecting polygons.

example1

Still unable to use the clipper to create a Mask, I decided to look at the error output on the Map. The snapping tool isn't fixing these nodes.

example2

Here's a larger picture of the area.

example3

I wonder if it would be easiest just to dissolve these shapes in some way.

Best Answer

When I get errors like this I usually find applying a zero distance buffer can fix the geometries. So use the buffer tool in QGIS and set the buffer distance to 0 units. Then try and use this buffered layer as the mask.