6

I inherited some shapefiles that I've been trying to clean up in QGIS and Grass. The shapefile is a large area covering a watershed, the person who digitized it, did so in small chunks without using the snapping tool, so there were many overlaps and gaps. I cleaned those up with the dissolve tool, and everything seems fine.

This is when we run into the problem. When I validate the shapefile, it comes out as invalid with 4 different errors. They are all "polygon inside polygon" but they show up at the coordinates 0,0 and there's nothing actually there.

Has anyone ever had this error?


Here's a link to a Google Drive folder with the files I've included the shapefile in question, and the two files created from the validation tool. I also included a PSR file showing my steps.

Basically, I'm trying to find the location of the error, according to the Error layer, and when I zoom into the selection it brings me to the coordinates 0,0, and there's no error there.

3
4

Interesting shapefile! I had trouble cleaning it with standard tools such as Geometry Checker and GRASS's v.clean. But an alternative method is to:

  1. Convert your polygons to lines:

    Vector > Geometry Tools > Polygons to lines
    
  2. Convert the lines back into polygons:

    Vector > Geometry Tools > Lines to polygons
    
  3. Use SAGA's Symmetrical Difference tool with Layer A as result from Step 2; Layer B as your original CootesAoIMar2.shp layer (you can choose if you want to use the Split Parts option).

    Processing Toolbox > SAGA > Vector polygon tools > Symmetrical difference
    
  4. Use SAGA's Symmetrical Difference tool again with Layer A as result from Step 2; Layer B as result from Step 3 (again, choose if you want to split parts).

  5. The result should match that of your original CootesAoIMar2.shp layer with hopefully no errors which you can check again using the Check validity tool.


Showing the first 3 steps

Showing different layers

Showing the final valid output:

Result

5
  • Thank you! This definitely helped, but I'm still getting some issues. Oddly enough, when I use the geometry validation tool on it, I get a valid output. But at this point I can't edit the geometry or anything like that, as it tells me that the geometry is invalid. I upload the new file (ValidOutputMar8) to my Google Drive. – Kristian Mar 8 '17 at 17:14
  • @Kristian - Glad it helped somewhat! How are you trying to edit the geometry? Moving nodes, reshaping, making holes etc? When I do those things, it works fine (tested on your newly uploaded shapefile too). I'm using QGIS 2.18.2 for Win7 64-bit. – Joseph Mar 9 '17 at 9:54
  • I've found moving nodes has been fine. I was trying to split off parts and features – Kristian Mar 9 '17 at 16:50
  • 1
    I managed to get rid of the issue! I had to manually go through all of the vertices and look for digitizing errors and mixed up areas. But, after doing that it's letting me split features and it's not showing the file as an invalid geometry in the topology checker. – Kristian Mar 9 '17 at 21:48
  • @Kristian - Awesome! Glad you got it working :) – Joseph Mar 10 '17 at 9: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.