1

I have a polygon layer (obtained from Raster to Polygon) with some invalid geometries. I would like to know how can I solve this without going one by one

enter image description here


This may be what answer is suggesting:

enter image description here


After trying solution from answer, the result is not correct.

Any idea?

enter image description here

  • Is the source raster also in UTM 34N? It might help to work in the raster's CRS. – AndreJ Aug 10 '17 at 9:57
  • Yes the projection of the raster is the same – GCGM Aug 10 '17 at 10:42
  • Maybe you should look over the polygonize process. For me, gdal_polygonize works well on a sample SRTM file. GRASS r.to.vect is another way. – AndreJ Aug 10 '17 at 13:27
1

A few options for you:

PostGIS (if available, easy to install locally if not and well worth it)

UPDATE TABLE schema.tablename set geom = ST_MakeValid(geom);

There is also the geometry checker plugin that ships with QGIS but is usually turned off (installed plugins), that has the option to fix all errors.

GRASS v.clean is also an option, available under processing tools in QGIS.

  • How do I use the GRASS v.clean? And is there a way to clear errors using the geometry checker? – Chimango Chisuwo Apr 18 '18 at 14:05
  • the geometry checker plugin will give you a report once it has finished checking, there will be an option to fix the errors either all or by selection. – Phil Barlow Apr 18 '18 at 15:11
  • I am using qgis 2.14.4 Essen and I cannot see any option in the check geometry validity window. – Chimango Chisuwo Apr 18 '18 at 15:44
  • Hi Chimango, apologies. I am refering to the "geometry checker", which you will find under Vector>Geometry Tools (you may need to enable it from the plugin manager first, its included with QGIS). Using the tool has two tabs: "settings" and "results", the results tab will be where your error report is displayed with the options to correct. Note that you have the option to either modify the layer you are checking or export the corrected layer (bottom of the settings tab) – Phil Barlow Apr 20 '18 at 9:51
  • Regarding GRASS v.clean, see here: grass.osgeo.org/grass75/manuals/v.clean.html – Phil Barlow Apr 20 '18 at 9:55
0

Try doing a buffer of zero, this should fix up your intersection issues

  • Hi, I edited the question to comment on your answer. Thanks – GCGM Aug 10 '17 at 6:43
  • @GCGM : If it works, don't forget to check the upper arrow on the left of the good answer + tick the V saying it résolves your problem. – gisnside Aug 10 '17 at 7:54
  • Hi, I edited again the question. The solution is not working unfortunately. – GCGM Aug 10 '17 at 9:52

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.