Bug report #15555

"Merge Selected Features" Tool don't work properly

Added by Tomas Cabezudo almost 4 years ago. Updated over 3 years ago.

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


I found many situations where this tool seems not work properly. I attach a zip file with a shapefile having two adjacent poligons (two pictures showing before and after included too).
Before this, I have verified them with topology checker tool whitout errors.

I select this two adjacent polygons, and when I ejecute this tool, I get a new polygon, but still appears some segments from comun edge in the new polygon..

MERGE_ERROR.ZIP - "Merge Selected Features" Tool don't work properly (107 KB) Tomas Cabezudo, 2016-09-12 12:51 AM


#1 Updated by Tomas Cabezudo almost 4 years ago

  • Assignee deleted (Tomas Cabezudo)

#2 Updated by Jukka Rahkonen almost 4 years ago

This is not a bug really but your data is not ready for merging. The two polygons do not share exactly same coordinates. Here is one example:

POINT (197903.09522296838 4796248.478830873)
POINT (197903.09522296768 4796248.478830872)

The difference is in the ninth decimal bet still the vertices are not the same. You must pre-process your data by snapping the vertices to some grid with a reasonable precision. Or then you could make a feature request for making the tool in QGIS to handle vertices with some given tolerance.

You can study your data with a quite useful tool in OpenJUMP Plus. The tool is in Plugins-Topology-Find coverage gaps and Find coverage overlaps in layer. Or you can use the Fence tool and the right-click-Other tools-Vertices In Fence. I do not mean to especially advertise OpenJUMP but I believe that QGIS does not have this kind of tools yet.

#3 Updated by Tomas Cabezudo almost 4 years ago

Thanks Jukka.

Yes, as You remarked me, some coordinates are different (but 0.000000001 mts..). Really, I don't know what is the value of epsilon to consider the same two values in floating point..
I try to use this tool after to establish setting for snap (to vertex, 0.001 map units), but result are the same.
Obviously, this tool works with no tolerance. Then, as you say, perhaps the best idea is to make a feature request for making the same tool in QGis, but adding tolerance value. I think that would be a more robust tool.

#4 Updated by Giovanni Manghi over 3 years ago

  • Resolution set to invalid
  • Status changed from Open to Closed

you can fix this kind of situations by using Processing/GRASS/v.clean and the snapping options.

Also available in: Atom PDF