QGIS Feature Merging – How to Merge Features of the Same Class

dissolvefeatureslayersqgisshapefile

I am running with a problem that I want to merge all the features of the same vector class into one attribute. Below the green layer is the forest layer that has more than 11 thousand features, I want it to be one row only.

enter image description here

The dissolve command is not working in this case as they are not sharing the same boundaries and I get the error following error.

QGIS version: 3.16.11-Hannover
QGIS code revision: 26cc1c76
Qt version: 5.15.2
GDAL version: 3.3.1
GEOS version: 3.9.1-CAPI-1.14.2
PROJ version: Rel. 8.1.1, September 1st, 2021
Processing algorithm…
Algorithm 'Dissolve' starting…
Input parameters:
{ 'FIELD' : ['DN'], 'INPUT' : 'D:\\Anlysis Sindh LC-2016\\Mangroves2015\\MangrovesCover_2015.shp', 'OUTPUT' : 'TEMPORARY_OUTPUT' }

Feature (47) from “MangrovesCover_2015” has invalid geometry. Please fix the geometry or change the Processing setting to the “Ignore invalid input features” option.
Execution failed after 0.22 seconds

Loading resulting layers
Algorithm 'Dissolve' finished

I have tried union command as well but no luck. I want that when clicked on a signal, all features should be selected.

enter image description here

Best Answer

Use the geoprocessing tool Fix geometries, then merge or dissolve the output:

This algorithm attempts to create a valid representation of a given invalid geometry without losing any of the input vertices. Already-valid geometries are returned without further intervention

Related Question