In my standalone script I want to use the SAGA tool "merge vector layers". According to the docs I need the following.
Thus, I wrote the following code to implement the tool:
def merge(self):
Parcel_channel2 = self.Parcel_Channel2()
intersection = self.intersection()
param = {'INPUT': [Parcel_channel2, intersection],
'MERGED': 'TEMPORARY_OUTPUT',
'SRCINFO': False,
'MATCH': True,
}
merge = processing.run('saga:mergevectorlayers', param)
vlayer = merge['MERGED']
QgsProject.instance().addMapLayer(vlayer)
return vlayer
When I try to run the script I get the following error message:
QgsProject.addMapLayer(): argument 1 has unexpected type 'str'
With native Qgs tools, this code works fine. However, it seems that SAGA doesn't return a VectorLayer but just the string in my 'outDir' variable. How do I get the output when using SAGA?
I'm using QGIS 3.10
Edit: I figured out, that native Qgs tools retun QgsMapLayer objects and saga tools return the path and name of a .shp file
C:/Users/denni/AppData/Local/Temp/processing_c0c1104bbc4447558e00113072ccc4d8/91e580e9c006429597540594cb000407/MERGED.shp
but I need a QgsMapLayer as result... how would I do that?