Bug report #13752

ftools dissolve (on master) produces empty output if input has invalid geometries

Added by Michele Mor about 4 years ago. Updated over 2 years ago.

Status:Closed
Priority:High
Assignee:-
Category:Processing/QGIS
Affected QGIS version:master Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:fixed/implemented
Crashes QGIS or corrupts data:Yes Copied to github as #:21779

Description

New description, see #13752-1

-----------------
Old description:

Hi.
Using QGIS 2.8.3 Wien I use Vector/Geoprocessing Tools/Dissolve to merge together polygons.
Unfortunately my new layer has an hole (missing polygons) where my original layer has polygons.
I am not able to add a screenshot within this text, so I attached it as a file.

The original layer is Units, the dissolved layer is sectors.
To dissolve the original layer I have used field PCSECTOR.

I have attached 2 zip files.

Note: using QGIS 2.12 dissolve does not work!

Thanks.
Michele

2015-11-04_10_39_04-QGIS_2.8.3-Wien.png (16.6 KB) Michele Mor, 2015-11-04 02:52 AM

Units.zip (232 KB) Michele Mor, 2015-11-04 02:52 AM

Sectors.zip (32.9 KB) Michele Mor, 2015-11-04 02:52 AM

Associated revisions

Revision 62a571d6
Added by Alexander Bruy almost 4 years ago

[processing] skip invalid geometries when dissolving (fix #13752)

History

#1 Updated by Giovanni Manghi about 4 years ago

  • Crashes QGIS or corrupts data changed from No to Yes
  • Subject changed from QGIS Dissolve creates holes (polygons disappear) to ftools dissolve (on master) produces empty output if input has invalid geometries
  • Category set to 44
  • Priority changed from Normal to Severe/Regression
  • Target version set to Future Release - High Priority
  • Affected QGIS version changed from 2.8.3 to master

The real issue in now another: on QGIS > 2.8.3 with the provided sample data dissolve produces an empty output.

The problem with the "hole" on qgis <= 2.8.3 is somehow expected: the input file has invalid geometries (you can see it clearly also in the attached screenshot) and ftools dissolve (as any other tool in ftools) is fragile in this cases. Anyway in QGIS we have robust alternatives, try the grass or saga dissolve in the Processing toolbox and you'll get the expected results.

#2 Updated by Michele Mor about 4 years ago

Hi Giovanni,

I have tried with GRASS and it had the same issue.
It worked with SAGA.
I am confused thou, because I cannot understand what is wrong with that layer.
I am not trying to modify any polygons, just to merge some if they have the same sector and if they are adjacent, otherwise they should simply become "islands" with the same name.

#3 Updated by Giovanni Manghi about 4 years ago

I have tried with GRASS and it had the same issue.

weird, it works ok here.

I am confused thou, because I cannot understand what is wrong with that layer.
I am not trying to modify any polygons, just to merge some if they have the same sector and if they are adjacent, otherwise they should simply become "islands" with the same name.

your layer has a few geometry errors (see below), said that recently the qgis geometry support has been rewritten and a few native tools (geoprocessing tools) have now to be updated to cope with this changes.

Gap check: TopologyException: Input geom 0 is invalid: Self-intersection at or near point -2.4302612316084109 52.445251349342556 at -2.4302612316084109 52.445251349342556
Duplicate check between features 132 and 129: TopologyException: Input geom 0 is invalid: Self-intersection at or near point -2.4302612316084109 52.445251349342556 at -2.4302612316084109 52.445251349342556
Duplicate check between features 132 and 130: TopologyException: Input geom 0 is invalid: Self-intersection at or near point -2.4302612316084109 52.445251349342556 at -2.4302612316084109 52.445251349342556
Duplicate check between features 132 and 131: TopologyException: Input geom 0 is invalid: Self-intersection at or near point -2.4302612316084109 52.445251349342556 at -2.4302612316084109 52.445251349342556
Duplicate check between features 133 and 132: TopologyException: Input geom 1 is invalid: Self-intersection at or near point -2.4302612316084109 52.445251349342556 at -2.4302612316084109 52.445251349342556
Duplicate check between features 134 and 132: TopologyException: Input geom 1 is invalid: Self-intersection at or near point -2.4302612316084109 52.445251349342556 at -2.4302612316084109 52.445251349342556
Duplicate check between features 137 and 132: TopologyException: Input geom 1 is invalid: Self-intersection at or near point -2.4302612316084109 52.445251349342556 at -2.4302612316084109 52.445251349342556
Duplicate check between features 138 and 132: TopologyException: Input geom 1 is invalid: Self-intersection at or near point -2.4302612316084109 52.445251349342556 at -2.4302612316084109 52.445251349342556
Duplicate check between features 139 and 137: TopologyException: Input geom 0 is invalid: Self-intersection at or near point -2.4302612316084109 52.445251349342556 at -2.4302612316084109 52.445251349342556
Duplicate check between features 139 and 10: TopologyException: Input geom 0 is invalid: Self-intersection at or near point -2.4302612316084109 52.445251349342556 at -2.4302612316084109 52.445251349342556
Duplicate check between features 139 and 61: TopologyException: Input geom 0 is invalid: Self-intersection at or near point -2.4302612316084109 52.445251349342556 at -2.4302612316084109 52.445251349342556
Duplicate check between features 139 and 131: TopologyException: Input geom 0 is invalid: Self-intersection at or near point -2.4302612316084109 52.445251349342556 at -2.4302612316084109 52.445251349342556
Duplicate check between features 139 and 132: TopologyException: Input geom 0 is invalid: Self-intersection at or near point -2.4302612316084109 52.445251349342556 at -2.4302612316084109 52.445251349342556
Duplicate check between features 139 and 133: TopologyException: Input geom 0 is invalid: Self-intersection at or near point -2.4302612316084109 52.445251349342556 at -2.4302612316084109 52.445251349342556
Duplicate check between features 143 and 139: TopologyException: Input geom 1 is invalid: Self-intersection at or near point -2.4302612316084109 52.445251349342556 at -2.4302612316084109 52.445251349342556
Duplicate check between features 143 and 132: TopologyException: Input geom 1 is invalid: Self-intersection at or near point -2.4302612316084109 52.445251349342556 at -2.4302612316084109 52.445251349342556
Duplicate check between features 147 and 132: TopologyException: Input geom 1 is invalid: Self-intersection at or near point -2.4302612316084109 52.445251349342556 at -2.4302612316084109 52.445251349342556

#4 Updated by Michele Mor about 4 years ago

Hi Giovanni,
thanks for your feedback.
If I'll have time I'll try again with GRASS.
I will try to remember to do some testing/repair for my layer next time before applying a dissolve.

#5 Updated by Alexander Bruy almost 4 years ago

  • Status changed from Open to Closed

#6 Updated by Alexander Bruy almost 4 years ago

  • Resolution set to fixed/implemented

#7 Updated by Giovanni Manghi over 2 years ago

The "ftools" category is being removed from the tracker, changing the category of this ticket to "Processing/QGIS" to not leave the category orphaned.

#8 Updated by Jürgen Fischer over 2 years ago

  • Regression? set to No
  • Easy fix? set to No
  • Description updated (diff)
  • Priority changed from Severe/Regression to Low

#9 Updated by Jürgen Fischer over 2 years ago

  • Priority changed from Low to High

Also available in: Atom PDF