I have a SAGA Raster Calculator algorithm inside a model that I'm building.
For the formula, I'm using the function (g1>20)*1
to give me a binary raster output. This categorises pixels to buildings (1) or ground (0) depending on whether the altitude is 20m or more. This works as expected!
I can link this string expression into a string parameter in my model, and use this when I run my model.
For ease-of-use, I'd rather provide the threshold value of 20 as a numerical input value. So rather than
a string parameter "Minimum Height Expression" of "(g1>20)*1"
It would be something like
a number parameter "Minimum Height" of 20
And the expression inside the algorithm would be something like
(g1>[Minimum Height])*1
Is token subsititution like this possible with Processing? Or is there another way to get around this?
number
parameter then your Raster Calculator expression could be something like'(g1>' + number_parameter + ')*1'
. – Joseph Oct 28 '15 at 13:19Batch String Replace via regex dictionary
). I'll write it up when I've implemented it. :) – Steven Kay Oct 28 '15 at 15:13