I am using QGis Graphical Modeler v.3 It is possible to define, as an Input, a Matrix, defined as follows: "A table (matrix) parameter for processing algorithms".
I want to use values stored within a Matrix in the Field Calculator, but I do not know how to call for them.
When I open the Field Calculator, I see the reference to other parameters (e.g. Vector Layer, as in the image) but nothing related to the Matrix.
Which is the syntax to call for Matrix values e.g. Matrix (i j)?
Same issue with Enum Parameter (Input).
I searched everywhere but the only related discussion I have found appears to me as related to the GUI: https://github.com/qgis/QGIS/pull/6936
-
Welcome to GIS.SE. Have you tried calling an example matrix from the field calculator outside the modeller? If so, where have you failed?Erik– Erik2019年10月15日 15:52:44 +00:00Commented Oct 15, 2019 at 15:52
-
1Thanks @Erik! I do not know how to call an example matrix neither in the FC outside the modeler. Until now, I was not able to find the syntax.frasogniesintomi– frasogniesintomi2019年10月15日 16:05:48 +00:00Commented Oct 15, 2019 at 16:05
-
2In my experience if you can't find documentation for a graphical modeler feature it probably doesn't exist. You may have to figure it out by trial and error. Write a very simple model that uses a very simple matrix as input (eg a 2x2 matrix with the values 1,2,3 and 4), where the model output depends on calling a matrix value. Experiment with different syntax until you find one that gives an output instead of an error message. Since you used unique values in your input matrix, you'll know based on the output which matrix location you managed to call.csk– csk2019年10月15日 18:52:48 +00:00Commented Oct 15, 2019 at 18:52
-
2This (resolved) issue on github has a test model attached to it. Try downloading that model and see if it has the correct syntax.csk– csk2019年10月15日 18:54:52 +00:00Commented Oct 15, 2019 at 18:54
-
2Here's the link I forgot to put in my previous comment: issues.qgis.org/issues/18734csk– csk2019年10月15日 19:00:20 +00:00Commented Oct 15, 2019 at 19:00
1 Answer 1
A matrix is an input for raster files and the field calculator is for vector files. Therefore this connection is not possible.
The matrix can be used in raster file algorithms such as the "User Defined Filter". For example in the Default Filter Matrix (3x3) input, you can change it to Model Input, and then your Matrix will be available.
Enum, on the other hand, should be used in entries that may have more than one option, both in vectors and rasters, for example in "Simple Filter" and "Field Calculator".