5

I am trying to use field caluclator within a model. In this formula I want to reference the output (temporary layer) of another step of the same model (output objektfilter_strassen_wege, which is named strassenpolygone_flurstuecke). Since this layer is not loaded in QGIS, I get no result. If I save the correct layer after running through the model and have the model repeated, I get a result. But that's not my goal! I want to get it the first time. I enter the following into the field calculator:

aggregate(
 layer:= 'strassenpolygone_flurstuecke',
 aggregate:='concatenate',
 expression:=oid,
 concatenator:=', ',
 filter:=intersects($geometry, geometry(@parent))
 )

strassenpolygone_flurstuecke should be called differently as input, I suspect. So not layer:= but something else that suggests that it is a generated output. The second possibility that went through my head was to choose to save the layer strassenpolygone_flurstuecke instead of the temporary layer. But even if I do this using the model, I don't get any result.


1
  • Have tried this kind of calculations within graphical modeler a lot, but never made it work. A similar question about this is still unanswered. I am afraid the answer is "not possible", but lets hope for the best.
    – MrXsquared
    Nov 18, 2020 at 13:09

2 Answers 2

5

This is currently (QGIS 3.16.1) not possible, see the following comment from https://github.com/qgis/QGIS/issues/30397#issuecomment-505699624 :

The issue here is that expression functions which operate on map layers [...] don't currently have access to any temporary output layers created a step in a model. This applies to a lot of functions, including aggregates.

Here is another ticket describing your use case which is marked as a duplicate of the ticket linked above: https://github.com/qgis/QGIS/issues/37347

2
  • Hello pathmapper, thanks for your answer. Unfortunately, I am not looking for an input layer which is an output of another step but for the layer in my formula within the field calculator. The field calculator is part of my geaphical model.
    – Alice123
    Nov 25, 2020 at 13:48
  • @Alice123 thanks for your reply. Unfortunately this is currently not possible, see my adapted answer above.
    – pathmapper
    Nov 26, 2020 at 8:28
0

I came across this post while looking for a solution to a similar problem. You just had to replace the layer name with @layer.

aggregate(
 layer:= @layer,
 aggregate:='concatenate',
 expression:=oid,
 concatenator:=', ',
 filter:=intersects($geometry, geometry(@parent))
 )

Your Answer

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

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