5

I've been trying to clean up some vector data sets so that I can reproject them to WGS84 but I keep finding topological errors that fail the process. The one error I can't resolve involves a node on a polygon that shared by more than two (2) of that polygon's edges. For example:

enter image description here

Ideally, I would want to remove these types of topology errors so that I can reproject the shapefile but the QGIS 3 "Check Geometries" tool doesn't offer any suggestions on how to do it. I'm wondering what the best course of action is for these situations and if there is a tool/method that works best for these situations.

5
  • 1
    Could you add one such polygon as WKT into your question?
    – user30184
    May 9, 2018 at 21:24
  • The solution depends on whether the two lines cross each other, or simply share a vertex. In the second case, you can simply move one of the vertices using the vertex editor.
    – csk
    May 11, 2018 at 16:44
  • @Will: I'm afraid that it's not so easy to give additional advice as long as we don't have more details. It really depends on the very case: so what works in one instance might not work in another context.
    – Babel
    Oct 2, 2021 at 19:43
  • 1
    If it's a "banana" polygon, you can try a buffer at 0. Oct 4, 2021 at 9:06
  • 1
    Have you tried the Vector geometry - Fix geometries tool? What method are you using to reproject your data that runs into a geometry error and halts? If you use Export features and change the CRS to WGS 84 does that work?
    – johns
    Oct 4, 2021 at 17:04

2 Answers 2

4
+100

There are quite a few automated tools for checking and repairing geometries in QGIS. The question is - why are they invalid in the first place? It may be helpful to go back upstream to figure out why this is happening. Often, we may not have the time or people may be unaware of how those invalid geometries come up. It is often better to inspect the individual geometries to verify visually what is going on and you can manually repair geometries in QGIS.

That said, you may just want an automated solution.

In QGIS there are a few automated tools:

To check for invalid geometries:

Vector Geometries --> Check Validity

enter image description here

This will show you were any invalid geometries are located and what is causing them. You can then zoom into any area and edit the geometries to fix

To automate fixing geometries:

  1. One method is to use a Buffer value of 0 or a really small number like 0.0001. This may resolve some geometry issues.

  2. Vector Geometries --> Fix Geometries tool enter image description here

  3. GRASS --> Vector --> v.clean enter image description here

2
  • 1
    Thanks, in this instance, it's publicly available shapefiles from my local government. :/ In my instance, creating a small buffer fixed nearly all of them for me but awarding the points for the other solutions as well. (mapshaper's clean parameter also worked on for me as well!)
    – Will
    Oct 8, 2021 at 15:32
  • @Will might be worth emailing their department! Typically these accumulate because boundaries do not always align properly or topology rules aren't defined.
    – GISHuman
    Oct 8, 2021 at 16:34
1

Did you tried uploading your data to MapShaper?:

https://mapshaper.org/

It has an option to fix topology issues:

https://github.com/mbloch/mapshaper/wiki/Topology-Issues

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.