8

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?

  • 3
    Try running the algorithm v.clean on alaska or a buffer with 0 width. – Matthias Kuhn Feb 24 '18 at 13:16
  • I've opened the alaska.shp and it is good, without any validation errors. – jgrocha Feb 24 '18 at 14:16
  • I check the validity (again, with QGIS algorithm) and it detects the problem. I'll write the solution as an answer. – jgrocha Feb 24 '18 at 14:29
  • @Bryan Welcome to GIS SE! As a new user please take the tour to learn about our focused Q&A format. – Midavalo Feb 25 '18 at 16:43
8

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

  • This Fix geometries algorithm is available is QGIS 3. – jgrocha Feb 25 '18 at 13:42
6

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

  • 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 8:26

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.