2

I overlay several Shapefile layers with Vector > Geoprocessing Tools > Union in QGIS. The first five layers do work. However, when I'm trying to add another layer I receive the following error during the execution:

QGIS version: 3.16.0-Hannover
QGIS code revision: 43b64b13f3
Qt version: 5.11.2
GDAL version: 3.1.4
GEOS version: 3.8.1-CAPI-1.13.3
PROJ version: Rel. 6.3.2, May 1st, 2020
Processing algorithm…
Algorithm 'Union' starting…
Input parameters:
{ 'INPUT' : 'C:/Users/lucas/Desktop/Master Thesis/Python/Data_New/gis_data.shp', 'OUTPUT' : 'TEMPORARY_OUTPUT', 'OVERLAY' : 'C:/Users/lucas/Desktop/Master Thesis/Python/Data_New/Soil Moisture/Soil_Moisture_FR_CRS.shp', 'OVERLAY_FIELDS_PREFIX' : '' }

Feature (53320) from “gis_data” has invalid geometry and has been skipped. Please fix the geometry or change the Processing setting to the “Ignore invalid input features” option.
Feature (54670) from “gis_data” has invalid geometry and has been skipped. Please fix the geometry or change the Processing setting to the “Ignore invalid input features” option.
Feature (55047) from “gis_data” has invalid geometry and has been skipped. Please fix the geometry or change the Processing setting to the “Ignore invalid input features” option.
Feature (61804) from “gis_data” has invalid geometry and has been skipped. Please fix the geometry or change the Processing setting to the “Ignore invalid input features” option.
Feature (62961) from “gis_data” has invalid geometry and has been skipped. Please fix the geometry or change the Processing setting to the “Ignore invalid input features” option.
Feature (63483) from “gis_data” has invalid geometry and has been skipped. Please fix the geometry or change the Processing setting to the “Ignore invalid input features” option.
Feature (66206) from “gis_data” has invalid geometry and has been skipped. Please fix the geometry or change the Processing setting to the “Ignore invalid input features” option.
Feature (66218) from “gis_data” has invalid geometry and has been skipped. Please fix the geometry or change the Processing setting to the “Ignore invalid input features” option.
Feature (53320) from “gis_data” has invalid geometry and has been skipped. Please fix the geometry or change the Processing setting to the “Ignore invalid input features” option.
Feature could not be written to Union_146bc6b6_c533_488a_9c56_d9f8c0a8d007: Could not add feature with geometry type GeometryCollection to layer of type MultiPolygon
Feature (54670) from “gis_data” has invalid geometry and has been skipped. Please fix the geometry or change the Processing setting to the “Ignore invalid input features” option.
Feature could not be written to Union_146bc6b6_c533_488a_9c56_d9f8c0a8d007: Could not add feature with geometry type GeometryCollection to layer of type MultiPolygon
Feature (55047) from “gis_data” has invalid geometry and has been skipped. Please fix the geometry or change the Processing setting to the “Ignore invalid input features” option.
Feature (61804) from “gis_data” has invalid geometry and has been skipped. Please fix the geometry or change the Processing setting to the “Ignore invalid input features” option.
Feature (62961) from “gis_data” has invalid geometry and has been skipped. Please fix the geometry or change the Processing setting to the “Ignore invalid input features” option.
Feature (63483) from “gis_data” has invalid geometry and has been skipped. Please fix the geometry or change the Processing setting to the “Ignore invalid input features” option.
Feature could not be written to Union_146bc6b6_c533_488a_9c56_d9f8c0a8d007: Could not add feature with geometry type GeometryCollection to layer of type MultiPolygon
Feature (66206) from “gis_data” has invalid geometry and has been skipped. Please fix the geometry or change the Processing setting to the “Ignore invalid input features” option.
Feature (66218) from “gis_data” has invalid geometry and has been skipped. Please fix the geometry or change the Processing setting to the “Ignore invalid input features” option.
Feature (53320) from “gis_data” has invalid geometry and has been skipped. Please fix the geometry or change the Processing setting to the “Ignore invalid input features” option.
Feature (54670) from “gis_data” has invalid geometry and has been skipped. Please fix the geometry or change the Processing setting to the “Ignore invalid input features” option.
Feature (55047) from “gis_data” has invalid geometry and has been skipped. Please fix the geometry or change the Processing setting to the “Ignore invalid input features” option.
Feature (61804) from “gis_data” has invalid geometry and has been skipped. Please fix the geometry or change the Processing setting to the “Ignore invalid input features” option.
Feature (62961) from “gis_data” has invalid geometry and has been skipped. Please fix the geometry or change the Processing setting to the “Ignore invalid input features” option.
Feature (63483) from “gis_data” has invalid geometry and has been skipped. Please fix the geometry or change the Processing setting to the “Ignore invalid input features” option.
Feature (66206) from “gis_data” has invalid geometry and has been skipped. Please fix the geometry or change the Processing setting to the “Ignore invalid input features” option.
Feature (66218) from “gis_data” has invalid geometry and has been skipped. Please fix the geometry or change the Processing setting to the “Ignore invalid input features” option.
GEOS geoprocessing error: difference failed.


Execution failed after 2419.39 seconds

Loading resulting layers
Algorithm 'Union' finished

The Shapefile I want to add consists of several processed Rasterfiles from the german weather service (https://opendata.dwd.de/climate_environment/CDC/grids_germany/multi_annual/soil_moist/). The rasterfiles contain soil moisture data of individual months, that I process one single layer.

My main processing steps were:

  1. Use Field Calculator with
(("grids_germany_multi_annual_soil_moist_1991-2010_01.asc@1" > 29) AND ("grids_germany_multi_annual_soil_moist_1991-2010_01.asc@1" <= 50)) * 1 +(("grids_germany_multi_annual_soil_moist_1991-2010_01.asc@1" > 50) AND ("grids_germany_multi_annual_soil_moist_1991-2010_01.asc@1" <= 81)) * 2 + (("grids_germany_multi_annual_soil_moist_1991-2010_01.asc@1" > 81) AND ("grids_germany_multi_annual_soil_moist_1991-2010_01.asc@1" <= 110)) * 1 +("grids_germany_multi_annual_soil_moist_1991-2010_01.asc@1" > 110) * 0

to classify soil moisture stages to allow easier data handling and merging

  1. Use Raster > Conversion > Polygonize to vectorize the raster data
  2. Use Fix Geometries to avoid damaged polygons
  3. Use Vector > Geoprocessing Tools > Clip to clip to investgation area boundaries
  4. Use Vector > Geoprocessing Tools > Union to join the shapefiles
  5. Use Field Calculator with
CASE
WHEN "SM1" = 0 OR "SM6" = 0 OR "SM7" = 0 OR "SM8" = 0 OR "SM9" = 0 OR "SM11" = 0 OR "SM12" = 0 THEN  0
WHEN "SM1" = 2 AND "SM6" = 2 AND "SM7" = 2 AND "SM8" = 2 AND "SM9" = 2 AND "SM11" = 2 AND "SM12" = 2 THEN  0
ELSE 1
END

to create Moisture Category.

  1. Delete individual months
  2. Save to correct CRS

Then I want to add this processed Shapfile to another one and get the error.

I can't see why the Geometry Type of my Shapefile should be GeometryCollection. Is there a way to change the Geometry Type or another way of combining the Shapefiles?

1
  • Welcome to GIS Stackexchange. Error messages should be posted as text, not as a screenshot. Please take the tour to see how this site works.
    – Ian Turton
    Feb 5, 2021 at 17:56

1 Answer 1

2

I have found a solution that worked for me:

  1. I used Fix Geometries from the Processing Toolbox to repair invalid/damaged polygons
  2. I used Polygon Union from the Processing Toolbox to join the shapefiles without error message

Your Answer

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

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