I create a plugin in QGIS using some algorithms from Processing. When I try to use one algorithm in two different outputs, the variable is not well called and I do not know why.
First call:
Processing.initialize()
params_ndvi = {
'INPUT': str(self.dlg.lineEdit.text()),
'POLYGONS': vl,
'OUTPUT': 'TEMPORARY_OUTPUT'}
feedback1 = QgsProcessingFeedback()
clip_ndvi = Processing.runAlgorithm("saga:cliprasterwithpolygon", params_ndvi, feedback=feedback1)
out_ndvi = clip_ndvi['OUTPUT']
Second call:
params_class_image = {
'INPUT': str(self.dlg.lineEdit_2.text()),
'POLYGONS': vl,
'OUTPUT': 'TEMPORARY_OUTPUT'}
feedback2 = QgsProcessingFeedback()
clip_classified = Processing.runAlgorithm("saga:cliprasterwithpolygon", params_ndvi, feedback=feedback2)
out_classified = clip_classified['OUTPUT']
In this third call, I want to run with the second call output as input but in the final result, in temporary files, the algorithm gives me the report of the first call. I do not know why because the input is well defined:
params_raster = {
'INPUT': str(out_classified),
'BAND': 1, 'OUTPUT_HTML_FILE': 'TEMPORARY_OUTPUT'}
feedback3 = QgsProcessingFeedback()
raster_class = Processing.runAlgorithm("native:rasterlayeruniquevaluesreport", params_raster, feedback=feedback3)
params = raster_class['OUTPUT']