Bug report #13368

Difference tool generates invalid geometries

Added by Jos Ferraro about 5 years ago. Updated over 1 year ago.

Status:Closed
Priority:Low
Assignee:-
Category:Processing/QGIS
Affected QGIS version:2.8.3 Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:end of life
Crashes QGIS or corrupts data:No Copied to github as #:21420

Description

When using the Difference... tool on two layers with valid geometries, QGIS produces a layer with invalid geometries.
To reproduce, use the attached file:
i) open layers minizona13 and retalho
ii) use Check Geometry Validity to verify that there is no error before
iii) use Difference... with layer retalho as Input and minizona13 as Difference
iv) use Check Geometry Validity to verify that there an error on the created layer
The difference that I get goes attached as well under tghe name difff_errada13

difference_invalid.rar (26.8 KB) Jos Ferraro, 2015-09-16 07:44 AM

geo_minizona.PNG (16.8 KB) Saber Razmjooei, 2015-09-16 03:02 PM

History

#1 Updated by Saber Razmjooei about 5 years ago

  • File geo_minizona.PNG added
  • Status changed from Open to Closed
  • Resolution set to invalid

There is a gap between FID 1 and FID 3 and hence the difference comes up with the small polygons.

#2 Updated by Jos Ferraro about 5 years ago

there may sure be a gap, but is it a valid reason to produce an invalid geometry?
I understand that if I operate on valid geometries the result should be valid no matter what. I don't care if the result has small polygons(I may actually want that) but I would like valid ones.

#3 Updated by Saber Razmjooei about 5 years ago

  • Resolution deleted (invalid)
  • Priority changed from Normal to Low
  • Status changed from Closed to Reopened

#4 Updated by Jukka Rahkonen about 5 years ago

This is the faulty geometry as WKT and it is a polygon which has a hole outside the shell. It should be either two distinct polygons or a multipolygon with two parts. JTS, GEOS, and QGIS itself is reporting it as invalid. It is also hard to correct by digitizing because the hole should be converted into another polygon feature.

POLYGON ((
-43.206147 -22.908303,
-43.207488 -22.908866,
-43.208452 -22.909126,
-43.207489 -22.908866,
-43.206147 -22.908303
), (
-43.209573 -22.909271,
-43.20957519759788 -22.90923750003237,
-43.20957519759788 -22.909237500032372,
-43.209573 -22.909271
))

#5 Updated by Jamie Portman about 5 years ago

We experience similar issues when using the 'Avoid Intersection' function.
We start with perfectly valid geometries, but when QGIS creates the new feature applying the rules, it allows itself to generate invalid geometries.

#6 Updated by Giovanni Manghi almost 4 years ago

  • Category changed from 44 to Processing/QGIS

#7 Updated by Giovanni Manghi over 3 years ago

  • Regression? set to No
  • Easy fix? set to No

#8 Updated by Giovanni Manghi over 1 year ago

  • Resolution set to end of life
  • Status changed from Reopened to Closed

Also available in: Atom PDF