4

I use QGIS 2.18.3 and I have a shapefile with around 30,000 lines and a lot of invalid geometries. It is imported from a CAD project. I managed to solve most of the invalidities with the break function of the v.clean tool from the GRASSGIS toolset.

The remaining errors, around 180, all have the same nature: they used to be closed lines in the CAD project (the outlines of stones) but are now open. So the two endpoints have exactly the same coordinates, therefore they overlap and the geometry is invalid.

Solutions I've tried:

  1. Used the snap function of the v.clean tool - the tool runs without problems but there are still errors afterwards. I've put the threshold on 0.005 m. In advanced parameters I've put the v.in.ogr snap tolerance to 0.005 m as well and the v.in.ogr min area to 0.0

  2. Used "lines to polygons" from the vector menu and converted the polygons back to lines again. All polygons were valid but when I convert them back to lines using "polygons to lines" the errors are still there.

Did I do something wrong or do you have any idea how to solve it in an automated way?

  • Update: i used the Check Validity tool to isolate the invalid geometries in a seperate layer, then used "explode lines" and then dissolved them by their unique identifier (luckily there was one in the attribute table). This reduced the number of invalid geometries to 54. If i repeat the process the number doesnt decrease anymore although the rest of the invalid geometries have the same issue – a.urbanite Feb 9 '17 at 18:16
  • I would recommend trying to use the MMQGIS plugin's "Delete Duplicate Geometries". – JohnR Feb 9 '17 at 20:42
  • wasnt that tool only for complete geometries like points/lines/polygons instead of vertices? anyway, i tried it but it didnt help. – a.urbanite Feb 10 '17 at 13:11
  • update: ok i tried the workflow described in my first update with another shapefile with the same problem. – a.urbanite Mar 3 '17 at 12:45
  • update2: ok i tried the workflow mentioned in my first update with another shapefile which has the same problem. workflow as follows: run "check validity"-tool, run "explode lines"-tool on invalid output, run "dissolve"-tool, run "Check validity"-tool ->no errors. if i now copy these valid geometries into the valid output of the validity check of the original shapefile and run the validity check again the errors are back! this has to be a bug or i am missing something about the specs of a shapefile... – a.urbanite Mar 3 '17 at 12:58
0

Try to create new layer using function 'Buffer' from vector menu using 0 as parameter

We're looking for long answers that provide some explanation and context. Don't just give a one-line answer; explain why your answer is right, ideally with citations. Answers that don't include explanations may be removed.

  • used the "fixed distance buffer" tool from te vector menu. Distance put at 0 and segments per default at 5. The resulting vectorlayer has all entries in the attribute table but no visible geometries. makes sense to me because we are creating polygons without area. but when i run "polyons to lines" the resulting line-layer also has no visible geometries – a.urbanite Feb 10 '17 at 13:48

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.