I try to run qgis:difference
on selected features of 2 layers. But the result of my code :
parameters = {'INPUT': QgsProcessingFeatureSourceDefinition(layer1.id(), True),
'OVERLAY': QgsProcessingFeatureSourceDefinition(layer2.id(), True),
'OUTPUT': 'memory:'}
differenced = processing.run('qgis:difference', parameters)
is a string output_...
instead of a QgsVectorLayer as usual.
I have added :
QgsProject.instance().addMapLayer(layer1, False)
QgsProject.instance().addMapLayer(layer2, False)
before but the algorithm doesn't work as I want.
layer1
andlayer2
?