Every user running a model selects a folder where the output of the model, a raster, should be stored as a file. The filename should be created automatically, based on an attribute value (timestamp) to succesively store the output of the same workflow for inputs representing different moments in time.
I created a model with QGIS 3.26 that does the following: 1) download a JSON-file from an URL, 2) load the file in QGIS as point layer, 3) run
v.surf.rst to create an interpolated surface (raster). For
Model Output of
v.surf.rst, I set a name. When I now run the model, I am prompted to define manually a filepath + filename where the output should be saved to. This model runs perfectly.
The online JSON-file is updated in regular intervals. So the model should run repeatedly and it should grab the timestamp in the attribute named
time of the downloaded JSON file. The filename should be created based on the timestamp, avoiding to create manually a filename each time the model runs and to have consistent filenames reflecting the time they represent.
What I tried
I added a
File/Folder input named
save_to, type set to
Folder: it promts me to select a folder when I run the model (this is because the modul should run on different machines for different users).
The idea now is to use this folder path for the output. I thus set the output value to
Pre-calculated Value and use the created variable
@save_to using this expression:
@save_to || 'output.tif'. Like this, the file is saved to the path defined in the prompt when running the model under the static filename
Question / where I'm stuck
The last step is now to make this filename dynamic, based on the attribute field name
time from the layer I downloaded. How to do this?