1

With the graphical modeler in QGIS, how can I update a field called "inters" from layer "a" by setting the values to 'yes' or 'no'. Values are determined on the intersection of another input layer "b". I used a string based on the overlay_intersects function, both as a "value" or "pre-calculated value" but it doesn't work:

enter image description here

I add a screen to clarify my test by using "rename a layer":

enter image description here

The model gives me an error about the expression used. Any suggestions?

Mark
  • 965
  • 6
  • 12

1 Answers1

0

When using the Field Calculator Algorithm, use this expression to update the field: overlay_intersects ('b'), where b is the layer name. See screenshot, where the output is labeled with the content of the updated inters field:

enter image description here


In case you want to use an output of a processing algorithm as input, instead of the layer name, use the variable of the algorithm: QGIS automatically adds a varibale with the algorithm's name and the suffix _OUTOUT - here, the variable's name to use is @This_is_my_buffer_algorithm_OUTPUT, based on my name This_is_my_buffer_algorithm I gave to the buffer algorithm and the @ character that indicates a variable.

In the screenshot below, I used a buffer algorithm, based on a point layer, to create a polygon layer and then I test on another layer called a if it intersects with this buffer layer:

enter image description here

Babel
  • 71,072
  • 14
  • 78
  • 208
  • If i use directly a layer loaded in the layer panel, this expression is ok; but my problem happens when i should use the output of a processing algorithm as input. I don't know how declare this in the expression. Thanks! – Mark May 29 '23 at 07:54
  • Add a rename layer algorithm to the model, rename the layer and use this as input. – Babel May 29 '23 at 08:15
  • See here: https://gis.stackexchange.com/a/421142/88814 – Babel May 29 '23 at 08:16
  • I renamed (with the rename layer algorithm) the buffer as 'buf', i checked the dependence and i used the expression overlay_intersects ('buf') as a value in the field calculator but it doesn't work. Any suggestions? – Mark May 29 '23 at 09:13
  • Not sure. Can you share the project/model – Babel May 29 '23 at 09:17
  • See updated answer for how to proceed. – Babel May 30 '23 at 15:01