4

I want to union about 35 shape files. It works fine exept for one. There I get the error message:

Feature could not be written to Union_c27e002e_a281_4323_92d4_d4d3f97beb1e: Could not add feature with geometry type MultiLineString to layer of type MultiPolygon Could not write feature

Both geometries are Polygons (MultiPolygon) not MultiLineStrings as given in the error message. I tied both invalid filter featuring = 'Do not filter' and 'Skip (Ignore) Features with invaldid geometry'. Likewise, using the tool 'Fix geometries' before does not help. Union (multiple) fails as well. When I change the order in which the union is done, it fails at a different overlay input.

I am using QGIS 3.32.1-Lima on Windows 10 and Python version 3.9.5 (I do the union in a for loop in python script, but it also fails when doing it by hand).

I found this QGIS issue on GitHub: https://github.com/qgis/QGIS/issues/52222. Is there a work around?

Edit

Here are some example shapes: https://baaderkonzept-my.sharepoint.com/:u:/g/personal/jakoby_baaderkonzept_de/EfGc9gWhDhdOshWiEKdcLxwBZ-pa-CBHo_OGDZjcNu24_g?e=NjsmV2

I can union clip2 and clip3, but none of them to clip1. clip1 contains all other unions that have worked before.

Multipart to singlepart and exporting to an new file did not help, the geometry checker only shows valid parts.

Edit 2

I also tried grass v.clean with the default settings for each file I want to union and on the union result before adding the next file. Still, in the long list of unions at a certain point the algorithm fails always with the same error message.

9
  • I also get that error sometimes, very annoying and I havent found a fix for it. You can try Snap geometries to grid on all inputs before you Union
    – Bera
    Commented Aug 4, 2023 at 10:14
  • Try to export that file to a new file. It might work. Also try the geometry checker plugin it might help.
    – GforGIS
    Commented Aug 4, 2023 at 11:17
  • I'd typically run v.clean from the GRASS tools when dealing with problem layers. I'd also look at converting any multipart layers to singlepart prior to the overlay.
    – John
    Commented Aug 4, 2023 at 14:24
  • Can you share example datasets? the one that makes problems and one that works, so union can be tested?
    – Thomas B
    Commented Aug 6, 2023 at 7:05
  • You are trying to Union clip1, with clip 1 as input layer, no overlay layer?
    – Bera
    Commented Aug 6, 2023 at 17:15

1 Answer 1

0

I would typically use the Check Validity Tool under the Geometry Tools Under the Vector Menu. It works most of the time provided you know which layers is the problem.

enter image description here

Alternatively, I try to convert that layer to a new file. It might work.

2
  • All geometries are valid and saving to a new file unfortunatelly does not help.
    – Mira
    Commented Aug 7, 2023 at 13:45
  • 1
    There is a new QGis3 plugin named "Multi Union" !
    – MLourdes
    Commented Nov 15, 2023 at 18:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.