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?

1
  • 2
    Hi, what is the expression used in update field algorithm? May 26, 2023 at 17:00

1 Answer 1

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

6
  • 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, 2023 at 7:54
  • Add a rename layer algorithm to the model, rename the layer and use this as input.
    – Babel
    May 29, 2023 at 8:15
  • See here: gis.stackexchange.com/a/421142/88814
    – Babel
    May 29, 2023 at 8: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, 2023 at 9:13
  • Not sure. Can you share the project/model
    – Babel
    May 29, 2023 at 9:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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