2

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

View of the Field Calculator

  • 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 Oct 15 '19 at 15:52
  • Thanks @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 Oct 15 '19 at 16:05
  • 1
    In 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 Oct 15 '19 at 18:52
  • 1
    This (resolved) issue on github has a test model attached to it. Try downloading that model and see if it has the correct syntax. – csk Oct 15 '19 at 18:54
  • 1
    Here's the link I forgot to put in my previous comment: issues.qgis.org/issues/18734 – csk Oct 15 '19 at 19:00
0

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.

enter image description here

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".

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.