Index de l'article

Merge vector layers

First, create and fill a list with your layers to merge, then:

myPath = r'C:\\Users\\georg\\Downloads\\'
 
project = QgsProject.instance()
 
...
 
parameters = {'LAYERS': listLayersToMerge,'CRS': 'EPSG:25832','OUTPUT': myPath + 'results.shp'}
processing.run("qgis:mergevectorlayers", parameters)
 
myMerge = QgsVectorLayer(myPath + 'results.shp', 'My merge', 'ogr')
project.addMapLayer(myMerge)

A full example here, search for Fusion de couches