16

I used the sample files located at this URL to learn QGIS: https://qgis.org/downloads/data/.

I tried to clip SR_50M_alaska_nad.tif using a shapefile as a mask (alaska.shp). The problem is I got this error which states that:

Ring Self-intersection at or near point .... Error 1: Cutline polygon is invalid.

How do I solve my problem using QGIS 2.18.9?

Marco
  • 3,230
  • 14
  • 37
bryan
  • 161
  • 1
  • 1
  • 3

2 Answers2

13

The original shapefile has geometry issues. I've run the Check validity with GEOS option selected and the output was "no erros". But I ran it again with QGIS selected and it detected errors.

Check validity with QGIS

The output was:

Check validity output

Running Fix geometries algorithm fixes the invalid geometries. I've also created another alaska shapefile in WGS84, to make sure the clipping layer is in the same coordinates as the raster.

enter image description here

jgrocha
  • 5,345
  • 25
  • 43
  • 1
    This Fix geometries algorithm is available is QGIS 3. – jgrocha Feb 25 '18 at 13:42
  • I was encountering the same issue. No problems were detected using either GEOS or QGIS settings in check validity. But after running fix geometries the problem went away. – DotPi Feb 18 '21 at 15:22
6

I fixed the issue using the v.buffer.distance algorithm with 0 width.

user2856
  • 65,736
  • 6
  • 115
  • 196
bryan
  • 61
  • 1
  • 1
    @Bryan Great that you were able to solve the problem yourself! Please [edit] your answer to give some more detail and some steps that you followed to actually fix the issue – Midavalo Feb 25 '18 at 16:41
  • I think Fix geometries is not available in QGIS 2.18.9, so @bryan you could mark your answer as the one that solved your problem, it will help others to identify a working approach – Marco Feb 26 '18 at 08:26
  • I try to fixed the issue using the v.buffer.distance algorithm with 0 width. It worked – Mohamed Gamal Gad Sep 07 '22 at 11:47