Bug report #14532

Dissolve and Spatial Query doesn't work

Added by Federico Gianoli almost 8 years ago. Updated almost 8 years ago.

Affected QGIS version:2.14.0 Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:
Crashes QGIS or corrupts data:No Copied to github as #:22505



I have a problem with the Dissolve tool and Spatial query.

I have a multipart polygon, created using dissolve tool, and a shp of points.
If I use "spatial query" and ask how many points are contained in these polygons, the results is 0, but this is not true.

The reference system is the same for all the layers (EPSG: 3003).

I have attached 3 shp:

-Centroidi (points layer)
-VenetoreclassOK (the source polygon layer)
-DissolveDN (the results of the Dissolve by the field DN)

Let's try another way to describe better the problem.

If I select, in the shp named DissolveDN, the DN categories 3 and 4, and than, using Spatial Query, I ask how many points are within the categories 3 and 4, the results is 0. By the way if I did the same spatial query selecting categories 1 or 2, the tool works.
Really I don't understand why.

Please help me to figure out this issue. I have tryed with QGIS 2.14 and 2.8.7.

thanks a lot


problems.rar - here the files (467 KB) Federico Gianoli, 2016-03-19 01:46 PM

dissolve_errors.png (34.3 KB) Anita Graser, 2016-03-20 02:09 AM


#1 Updated by Anita Graser almost 8 years ago

Please attach the files you mentioned.

#2 Updated by Federico Gianoli almost 8 years ago

I'm sorry, here the files.



#3 Updated by Anita Graser almost 8 years ago

The dissolved layer has tons of problems, while the original layer is completely fine. That's what most likely throws off the spatial query tool. Did you use dissolve from the vector menu (ftools) or from Processing?

#5 Updated by Anita Graser almost 8 years ago

  • Category set to Processing/QGIS

I now tried three dissolve algorithms in the Processing toolbox:

  • QGIS Dissolve: The result didn't even contain all input features
  • SAGE Dissolve: Looked ok but Spatial Query didn't select any centroids as "within"
  • GRASS Dissolve: This worked! Spatial Query selected 590 out of 591 as "within" (one is slightly outside of the polygons)

#6 Updated by Federico Gianoli almost 8 years ago

Thanks Anita,

I used Dissolve from processing toolbox.
so, in order to have a right multipart polygon, I have to use the GRASS tool?

In your opinion, why the dissolve tool doesn't work correctly?

Thanks a lot for your test.


#7 Updated by Maximilian Krambach almost 8 years ago

As to why QGIS Dissolve leaves out output: GEOS:combine (which is used by QGIS:dissolve) returns eight geometry errors, and in the output eight polygons are missing. I guess that QGIS:dissolve only writes "correct" geometries as output. Those "defect" geometries are cases where an inner ring touches the outer ring.

#8 Updated by Anita Graser almost 8 years ago

I guess the main issue with QGIS:dissolve's behavior is that there are zero warnings in the tool log or the QGIS message log. Instead, it just silently drops the features ...

#9 Updated by Maximilian Krambach almost 8 years ago

If I edit out the validity checks in dissolve.py , the polygon is dissolved just fine. Maybe dissolve should check for validity on the input, not the output

#10 Updated by Maximilian Krambach almost 8 years ago

  • Status changed from Open to Closed

QGIS Dissolve fixed in master (bec849c). Includes warnings to processing log, works with spatial query and does not drop valid geometries.

Also available in: Atom PDF