I wrote a progressing algorithm using Python. The tool uses multiple other processing tools in the toolbox and creates temporary outputs. Those outputs seem somehow saved while I was running the script while developing. Now, when I call my tool from the toolbox and want to select layer as an input, they appear in the selection even though they are created a while ago and they are not even loaded with QGIS Project that I am working.
This is how the input parameter in my script
self.addParameter(
QgsProcessingParameterVectorLayer(
self.GEOLOGIE_LAYER,
self.tr('Pfad zur geologischen Karte'),
defaultValue=0,
optional=False
)
)
Any idea how I can get rid of them?
I think this part of the script is producing those temporary layers
res2 = processing.run("native:clip", {
'INPUT': vlyr_ger,
'OVERLAY': vlyr_ezgStats,
'OUTPUT': 'TEMPORARY_OUTPUT'})
vlyr_gerClp = res2['OUTPUT']
vlyr_gerClp.setName('vlyr_gerClp')
removeBinaryFields(vlyr_gerClp)
lyrList.append(vlyr_gerClp)
QgsProject.instance().addMapLayer(my_layer, False)
, just remove thatFalse
) or if you're fine, we can also remove them from the project, after the script is executed, with a couple of lines. Which solution fits best for your use case?