-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
QGIS Union: wrong results #22799
Comments
Author Name: Giovanni Manghi (@gioman) As discussed in Las Palmas this ftools must return the right results, warn the users in case there are invalid geometries, or be removed entirely.
|
Author Name: Matthias Kuhn (@m-kuhn) Is the processing version of the algorithm ok? I think now that fTools is disabled by default we should mainly invest into making processing bulletproof and leave fTools as deprecated and "resolve" this issue with a warning in the plugin manager. |
Author Name: Matthias Kuhn (@m-kuhn)
|
Author Name: Giovanni Manghi (@gioman) Matthias Kuhn wrote:
unfortunately no.
|
Author Name: Giovanni Manghi (@gioman)
|
Author Name: Matthias Kuhn (@m-kuhn) Apparently the output is a mix of lines and polygons which shapefile isn't able to handle. When selecting the output format as GML a mixed geometry output is created. Does that look correct to you? When the output isn't able to handle the geometry type (e.g. lines here), should it just dismiss it? We could implement this option in QgsVectorFileWriter (and expose it to the user or not in the algorithm configuration dialog). Or is the mixed geometry output actually broken? Or are there better ideas?
|
Author Name: Giovanni Manghi (@gioman) Matthias Kuhn wrote:
Hi Matthias! the input and output of the Union operation is expected to be always of polygon type http://desktop.arcgis.com/en/arcmap/10.3/tools/analysis-toolbox/how-union-analysis-works.htm this is also true for the Difference operations http://webhelp.esri.com/arcgisdesktop/9.2/index.cfm?TopicName=Symmetrical_Difference_(Analysis) For the Intersection (that is kind of a Clip, except that in the output you have attributes from both input layers) http://webhelp.esri.com/arcgisdesktop/9.2/index.cfm?TopicName=Intersect_(Analysis)
|
Author Name: Giovanni Manghi (@gioman) Matthias Kuhn wrote:
please notice that in the wrong output produced by qgis there are also duplicated polygons that are not supposed to be there (compare with grass and saga results). |
Author Name: Matthias Kuhn (@m-kuhn) Ok, so it's just plain buggy. |
Author Name: Giovanni Manghi (@gioman) Matthias Kuhn wrote:
so, we ship again broken (f)tools? |
Author Name: Matthias Kuhn (@m-kuhn) Again or still... Apparently we do. |
Author Name: Giovanni Manghi (@gioman) Matthias Kuhn wrote:
I will try to put all the (f)tools issues (regarding wrong results) in one ticket. |
Author Name: Graeme Seggie (Graeme Seggie) To aid fix, I am attaching some files (in response to Matthias Kuhn feedback on email group) showing the results from simple UNION operations against shapefiles union'd with self and on each other. Files attached: Shapefile1 has three features - one of which (id=3) overlaps the other two (id=1 and id=2). Results of the processing from Vector --> Geoprocessing Tools --> Union also attached Shapefile1_union_Shapefile1 (15 features result) The first resulting shapefile shows nulls and features with seemingly no geometry, the latter looks more sensible. Graeme |
Author Name: Graeme Seggie (Graeme Seggie) File attached 'QGIS Union Test Shapefiles.zip'
|
Author Name: Etienne Trimaille (@Gustry) I tried on 2.16 and 2.18 too. I got some overlapping polygons too. These overlapping polygons are different if we do A union B or B union A. I put my test data in two geojson. On 2.14, the algorithm is not performing a union at all unfortunately. It's a kind of "difference".
|
Author Name: Etienne Trimaille (@Gustry) I'm working with the union algorithm again.
I will try to have a look. Just in case, I'm going to attach again two others layers which are producing this error, whatever the order layer A/B in the parameters. Sorry, it's not small layers, I will try to reduce them and see which polygon is failing.
|
Author Name: Tim Sutton (Tim Sutton) I took the sample dataset from @Gustry and reduced it to a minimal dataset that can be used to replicate the issue. Please see attached files.
|
Author Name: Tim Sutton (Tim Sutton) And an even simpler test dataset with one polygon each
|
Author Name: Enrico Fiore (Enrico Fiore) I have others remarks concerning the union function and about the results that produces (I tested shapefile format and temporary layer file)
Isn't better allow union only between point layer or polygon layer? Or allert the user that the result can be wrong or not complete? (the same issue, if it is a issue, can be showed with intersection) |
Author Name: Martin Dobias (@wonder-sk) The problem with data from Etienne/Tim is that the input feature in hazard layer has invalid geometry (self-intersecting outer ring). The algorithm is correct, just the input data are not correct. Applying ST_Buffer(geom, 0) to the hazard geometry fixes the invalid geometry and union works as expected afterwards. Currently there is a discussion among QGIS devs regarding how to best deal with invalid input geometries in processing algorithms... see #3865 |
Author Name: Giovanni Manghi (@gioman) Martin Dobias wrote:
Using liblwgeom (ST_MakeValid) seems a very good option: it works better then 0 distance buffer (that frequently changes the input layer by removing nodes and/or entire area) and is available (also on Windows) without needing to install PostGIS. |
Author Name: Giovanni Manghi (@gioman) new reference ticket for this matters is #25030
The issues that I have noticed are: Union returns records without any geometries and they are repeated more times. I suppose that they should be linked to the new geometries derived from the union output;some records without geometry should have geometries, because the records have values that derive from the union of the two input tables records;if you interrogate geometries, whit "identify" tool, in some cases it returns two results, but only one is linked to a geometry. You can find the relative record in the table, but if you select it in the table no geometry is selected;The same Union performed with GRASS (v.overlay in Processing tools) is correct. In attached the input file(circoscrizioni84 e quartieri84)and the fTools and GRASS results (circ84Quartieri84 / (circ84Quartieri84_grass). to I see this bugs report #17224, but I think that the issues are different. The issues that I have noticed are: Union returns records without any geometries and they are repeated more times. I suppose that they should be linked to the new geometries derived from the union output;some records without geometry should have geometries, because the records have values that derive from the union of the two input tables records;if you interrogate geometries, whit "identify" tool, in some cases it returns two results, but only one is linked to a geometry. You can find the relative record in the table, but if you select it in the table no geometry is selected;The same Union performed with GRASS (v.overlay in Processing tools) is correct. In attached the input file(circoscrizioni84 e quartieri84)and the fTools and GRASS results (circ84Quartieri84 / (circ84Quartieri84_grass). |
Author Name: Jürgen Fischer (@jef-n)
|
Author Name: Enrico Fiore (Enrico Fiore)
Original Redmine Issue: 14846
Affected QGIS version: master
Redmine category:processing/qgis
I see this bugs report #8456, but I think that the issues are different.
The issues that I have noticed are:
The same Union performed with GRASS (v.overlay in Processing tools) is correct.
In attached the input file(circoscrizioni84 e quartieri84)and the fTools and GRASS results (circ84Quartieri84 / (circ84Quartieri84_grass).
Related issue(s): #17224 (duplicates), #25030 (duplicates)
Redmine related issue(s): 8456, 17131
The text was updated successfully, but these errors were encountered: