QGIS Geometry Fix – How to Fix Invalid Geometry (Self Intersection)

geometryqgisself-intersection

Attempted to extract raster by mask layer in QGIS 2.18.15 and for one of my shapefiles, the command could not be executed. The error message reads "Warning 1: Ring Self-intersection at or near point 97.520362854004077 18.494590759277401
ERROR 1: Cutline polygon is invalid."

I executed the Check Validity function, and identified the source of this self-intersection.
Self-intersection

In trying to correct this 1 error, I have tried the following

  • (1) added a zero distance buffer using QGIS default plugin
  • (2) added a zero distance buffer using GRASS v.buffer.distance
  • (3) used multiple permutations of GRASS's v.clean & v.clean.advanced

But none of the above has rectified this issue i.e. when I run the Check Validity function, the error still persists. I have browsed through several threads within this forum but their solutions don't seem to work for me.

Best Answer

After downloading QGIS 3.2.1 'Bonn' and using the "Fix Geometries" function (which is described very similarly to ST_MakeValid in PostGIS), the previously invalid polygon is made valid i.e. it does not turn out to be invalid after using 'Check Validity'.

It seems though that the inversion is still present in the layer despite it being a valid polygon now. Fortunately for me, this inversion is much smaller than the spatial unit I am working on, and its influence on data quality as a whole is not markedly detrimental.

Thank you one and all.

Related Question