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

Dissolve (native) algorithm: "Could not add feature with geometry type GeometryCollection..." #53392

Closed
2 tasks done
agiudiceandrea opened this issue Jun 7, 2023 · 5 comments · Fixed by #57478
Closed
2 tasks done
Assignees
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

@agiudiceandrea
Copy link
Contributor

agiudiceandrea commented Jun 7, 2023

What is the bug or the crash?

When the output layer is a Temporary (memory) layer, then the processing algorithm "Dissolve" (native:dissolve) throws the error

Feature could not be written to Dissolved_43865acd_2535_446f_a5f1_1b9a152f67a2: Could not add feature with geometry type GeometryCollection to layer of type MultiPolygon (of multi-type depending on the input layer type)
Could not write feature into OUTPUT

and fails to complete the task in various circumstances:

  1. if the input layer doesn't contain any feature (similar to issue report Error when making buffer from empty layer with 'Dissolve result' option checked #46396) or if the input layer contains only features with null geometry:

    • it FAILS with default parameters
    • it doesn't fail setting one or more fields and / or
    • it doesn't fail setting 'SEPARATE_DISJOINT':True
  2. if the input layer contains only features with empty geometry:

    • it FAILS with default parameters
    • it FAILS setting one or more fields
    • it doesn't fail setting 'SEPARATE_DISJOINT':True even if one or more fields are set
  3. if the input layer contains both features with valid geometry and features with null geometry:

    • it doesn't fails in any circumstance
  4. if the input layer contains both features with valid geometry and features with empty geometry ( Dissolved: Could not add feature with geometry type GeometryCollection to layer of type MultiPolygon #53360):

    • it doesn't fails with default parameters
    • it FAILS setting one or more fields if any subset of features based on the field(s) set contains only features with empty geometry
    • it doesn't fail setting 'SEPARATE_DISJOINT':True even if one or more fields are set

Steps to reproduce the issue

For example,
for testing point 1 above: testlayer_1.zip
for testing point 2 above: testlayer_2.zip
for testing point 4 above: testlayer_4.zip (setting the field 'col1': doesn't fail; setting the field 'col2': fails)

Versions

QGIS 3.28.7 - QGIS 3.30.3 on Windows (OSGeo4W)

Supported QGIS version

  • I'm running a supported QGIS version according to the roadmap.

New profile

Additional context

No response

@agiudiceandrea agiudiceandrea added Processing Relating to QGIS Processing framework or individual Processing algorithms Bug Either a bug report, or a bug fix. Let's hope for the latter! labels Jun 7, 2023
@kannes
Copy link
Contributor

kannes commented Jan 2, 2024

Still happens in 3.34.

It is a really irritating misbehaviour in modeler pipelines. Same as #47348 it would be nice to have it simply output another empty layer.

@Saareem
Copy link

Saareem commented Feb 29, 2024

I also got this error when using Extract/Clip to clip a vector layer. Fixing the geometries and removing null geometries did not help in this. I'm baffled. Annoying behavior in modeler pipelines, indeed.

@timbo-barnes
Copy link

I think the wider issue is that, instead of discarding invalid geometry (i.e. 2 vertex 'polygons'), it's failing on them. No amount of fixing the geometries going into the various vector overlay tools will prevent this problem as the problem is geometry being generated from the tools themselves.
(I am constantly getting these errors in the modeler when doing lots of unions, clips etc etc)

@agiudiceandrea
Copy link
Contributor Author

@kannes, please see #57478.

@agiudiceandrea
Copy link
Contributor Author

@Saareem @timbo-barnes, please create a new issue report (if not already created) providing all the requested info and sample layer(s) with which the issue occurs.

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
4 participants