3

I trying to convert a raster layer into polygons with QGIS. At first, it seems there is no problem with doing that, but when I'm checking the output for invalid geometries, it always gives me some invalid geometries (Ring Self-Intersections as shown in the picture). Does anybody know, how to avoid this problem or a workaround for it?

enter image description here

  • In my case I did Reclassify and then convert to polygons. Making of less color classes decreases the number of output sqaure polygons – Pavel Pereverzev Feb 3 '17 at 10:42
  • I just have 4 classes and it gives me the same result when just having 2. But I don't understand why this should help, because how should it make non square polygons out of a single pixel. – humesh Feb 3 '17 at 10:50
  • How did you check for invalid geometries? Because solely from your screenshot it is impossible to tell, if this geometry is valid or not. These two white holes can also be just a normal polygon inside the blue one, because there is a node directly at the connection of the two white squares. – tallistroan Feb 3 '17 at 12:30
  • I checked with PostGIS's st_isvalid and the Topology Checker from QGIS. As I wrote in my question, the errors are caused by ring-self-intersections. So the picture shows a (blue) polygon with a inner ring, where I tried to highlight the ring-self-intersection. The problem is that these pixels were converted as one inner ring, which means that either two points of the ring have identical coordinates (my case) or one line of the ring intersects the other when crossing. In my opinion this should not be detected as intersection, its more a touching relationship in my case. wrong?? – humesh Feb 5 '17 at 15:57
  • but there are some other things I don't understand too... Why does the algorithm needs 10 points to create a ring of two squares in my case? Would it be a ring-intersection, when it would produce two rings instead of 1? – humesh Feb 5 '17 at 16:04
2

I found a possible workaround (inspired by Pavel's reply) by just applying the smooth geometry algorithm from QGIS. So I don't have "square polygons" anymore and this means no ring self intersections.

Thanks

2

You can use the clean function from GRASS gis that is available in Qgis via processing. In the processing toolbox you may use v.clean with the "break" cleaning tool. It will solve self intersections by adding nodes and splitting the polygon into two. You can also read the help inside the tool for the other cleaning methods. But for this particular problem break will work.

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.