Skip to content
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

Union fails when using a point and a polygon layer #44801

Open
py-qgis-user opened this issue Aug 23, 2021 · 9 comments
Open

Union fails when using a point and a polygon layer #44801

py-qgis-user opened this issue Aug 23, 2021 · 9 comments
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Processing Relating to QGIS Processing framework or individual Processing algorithms

Comments

@py-qgis-user
Copy link

py-qgis-user commented Aug 23, 2021

What is the bug or the crash?

In previous versions, geoprocessing (e.g. union, difference) worked, where the input layer was a point layer and the overlay layer was a polygon layer. It simply neglected that the overlay polygons could not be added to the point layer.

Since 3.16 this is not possible anymore. The processing will fail 'error GEOS geoprocessing: difference failed'

Is this a bug, or is it the new behaviour?

Steps to reproduce the issue

Create a point layer and add features
Create a polygon layer and add features
Perform Union with base Pointlayer and overlay Polygon layer

--> Error is 3.16, works in older versions.

Versions

3.16.8 Hannover

Additional context

No response

@py-qgis-user py-qgis-user added the Bug Either a bug report, or a bug fix. Let's hope for the latter! label Aug 23, 2021
@gioman gioman added the Processing Relating to QGIS Processing framework or individual Processing algorithms label Aug 24, 2021
@gioman gioman changed the title 3.16 - Vector Geoprocessing fails for points layers Vector geoprocessing fails for points layers Aug 24, 2021
@gioman gioman added the Feedback Waiting on the submitter for answers label Aug 24, 2021
@gioman
Copy link
Contributor

gioman commented Aug 24, 2021

Create a point layer and add features
Create a polygon layer and add features
Perform Union with base Pointlayer and overlay Polygon layer

@py-qgis-user

Intersection here works, while union does not and curiously the message error is "GEOS geoprocessing error: difference failed".

@py-qgis-user
Copy link
Author

py-qgis-user commented Aug 24, 2021

@gioman
For me intersection does not work. In older versions both union and intersection worked.

Note that when saving the file (so not a temporary layer output), the layer is written with all features processed correctly. I presume the code catches the errors of polygons not being able to be written to the point layer, and assumes the process has failed.

It might be that the error message is indeed difference failed... I translated from an other language

@gioman
Copy link
Contributor

gioman commented Aug 24, 2021

For me intersection does not work.

@py-qgis-user add some sample data.

Note that when saving the file (so not a temporary layer output), the layer is written with all features processed correctly.

@py-qgis-user so for you the operations fail only when outputting to a temp layer, and work if saving to a gpkg, etc.? right?

@gioman
Copy link
Contributor

gioman commented Aug 24, 2021

@py-qgis-user tried a few QGIS versions here, and in all intersection works (as expected I would say, as geometries are taken only from 1 input layer). Union doesn't work in recent versions, in this cases I always get the message

"GEOS geoprocessing error: difference failed".

On older versions, like 3.14, Union works. The log says something llike

Feature could not be written to Union_fc042ff2_5707_4730_b807_e8fa8719de5a
Feature could not be written to Union_fc042ff2_5707_4730_b807_e8fa8719de5a

because of course different type of geometries cannot be saved within the same layer. Anyway the output is produced and it has all the geometries of the first input and the attribute table as it is expected from a Union operation.

I'm not sure if this is a regression in QGIS or a changed behavior in some underlying library (GEOS).

@gioman gioman removed the Feedback Waiting on the submitter for answers label Aug 24, 2021
@gioman gioman changed the title Vector geoprocessing fails for points layers Union fails when using a point and a polygon layer Aug 24, 2021
@gioman
Copy link
Contributor

gioman commented Aug 24, 2021

Probably the same applies for lines/polygons.

@py-qgis-user
Copy link
Author

@gioman
I was wrong. Intersection works. But Difference does fail as well (obviously).
Due to my wrong translations...

I have not encountered the same problem for line input layers.

About the
Feature could not be written to Union_fc042ff2_5707_4730_b807_e8fa8719de5a Feature could not be written to Union_fc042ff2_5707_4730_b807_e8fa8719de5a

I presume these are the polygon features that can not be written in the processed point layer.
Note that when currently running an empty point layer, with an overlay polygon layer with features following is given:

Feature could not be written to Union_6afedeb9_7cc2_4c23_b646_937cb70ee035: Could not add feature with geometry type MultiPolygon to layer of type MultiPoint Feature could not be written to Union_6afedeb9_7cc2_4c23_b646_937cb70ee035: Could not add feature with geometry type MultiPolygon to layer of type MultiPoint Feature could not be written to Union_6afedeb9_7cc2_4c23_b646_937cb70ee035: Could not add feature with geometry type MultiPolygon to layer of type MultiPoint

@py-qgis-user
Copy link
Author

Any news on this problem or aspects to check? @gioman ?

@lbartoletti
Copy link
Member

@gioman @py-qgis-user For me it's normal. The difference between versions may come from GEOS. Do you have GEOS 3.9 with QGIS 3.16 and GEOS 3.8 in older versions?

@py-qgis-user
Copy link
Author

@lbartoletti :

3.9.1. I assume i should as the GEOS community why the behaviour has changed.
For QGIS i want to add that in the past these overlay features also could not be written, but the errors it threw were neglected.
In the last version the algorithm stops running, although the input features are correctly written (ergo: same output as in older versions)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Processing Relating to QGIS Processing framework or individual Processing algorithms
Projects
None yet
Development

No branches or pull requests

3 participants