You can use a virtual layer for that. Use this query:
from layer1 as l1, layer2 as l2, layer3 as l3, layer4 as l4
where l1.id = l2.id = l3.id = l4.id
The principle is demonstrated here with four layers, layer1 to layer4, each having an attribute field called id used to join them. Just add more layers using the same pattern in lines 2 and 3.
You also need to add the following lines:
# To import section
from qgis.analysis import QgsNativeAlgorithms
from processing.core.Processing import Processing
# after qgs.initQgis()
Sometimes developing a PyQGIS standalone application can be ...
What worked for me with a sample dataset similar to your sketch - but not with the data you provided. They contain some problematic geometries that you should fix (for any solution, I guess).
My dataset (compare result below):
Run Menu Vector / Geoprocessing / Union
Identify which of the overlapping parts you want to keep. In my example: the one with the ...
Here is an example that you could adapt to your solution:
List layers that you have in your specific group, in my case it is called plots.
Run your algorithm for each of the layers in your group.
Rename the layer using the layer used in the algorithm, and if you wish you can add the result to the map.
root = QgsProject.instance().layerTreeRoot()
for child ...
User 15Step was right. I had some NULL geometries in my bus stops, because I tried to delete some and lazy me used Vertex Tool that only removes the geometry not the feature itself. I had to delete the points completely.
This algorithm take a vector or table layer and aggregate features
based on a group by expression. Features for which group by expression
return the same value are grouped together.
This algorithm takes a vector layer and combines their features into
new features. One or more attributes can be specified to dissolve
The error is not about how you are returning the results, but that problems in your code are preventing the output layer from being correctly generated. Your main problem is that your output variable holds a layer id string, not an actual layer.
I would suggest a slightly different approach. Rather than running Save Selected Features as a child algorithm to ...