I am running QGIS 3.12.3 București on Windows 10 x64; I am building a simple model to reclassify a series of rasters with a 2x3 table, and then count each unique reclassified value within different polygons in a shapefile.
My input rasters follow a naming convention with area_type_year_satellite
, and I have rasters for each year over a long time span.
Now, since the input raster for the zonal histogram has to be a single entry, I am running the model as a batch process. I am successfully saving the output shapefiles with unique names according to the year
in the filename of each input rasters, as suggested here, using an expression similar to:
'C:/Users/user/Desktop/' || @inputsitespolygon || '_' || substr(@RastertoReclassify, 10, 4) || '.shp'
My issue is: the Zonal Histogram algorithm allows for predefining the name of each column of the output shapefile, and I am trying to obtain unique column names depending on the input raster filename, with a similar approach to the above, using either:
substr(@RastertoReclassify, 10, 4) || '_'
or
concat(substr(@RastertoReclassify, 10, 4), '_')
However, any expression I used seems to fail, and the columns in the output keep the default name (HISTO_
) or register only the last part of the concat
function:
My question is: is there a way to programmatically name the output columns based on the input raster filename?
Ideally, they should be something like 1986_0 | 1986_1
for one output; 1987_0 | 1987_1
for another, and so on. I have to say I am not familiar with Python, and I don't know how to build a custom processing script. Not sure if I am just missing something, but I am a bit clueless on how to achieve this.