I want to make a conditional branch in QGIS modeler based on the cell size of the incoming raster. If the cell size is larger than 10m, I would like to resample the raster to 10m before exporting it.
I am aware that one can add a conditional branch from Modeler tools
->Conditional branch
, from where you can define a Branch Name and a Condition. This Condition is implemented using the Expression Builder
. But since the 'Rasters'-function group does not offer a quick method like 'cell size', there is no straightforward way of making a conditional.
From this question I found you can get the cell size by calling the rasterUnitsPerPixelX()
method on a QgsRasterLayer object, but I have no clue how to implement that in a custom function, since the all the custom function examples I could find are using feature classes in stead of rasters.
So how can I make a conditional branch in the modeler based on the cell size of the incoming raster?
I'm using QGIS version 3.36.1