6

I want to do a simple merge of some algorithm outputs in QGIS graphical modeler (not for an iterative process, like my previous question "Collect results of iterative processes in QGIS graphical modeler", but just for two outputs of parallel/forked extractions).

I feel like this is so basic, it should be obvious: Right where it says 'Input layers' I ought to be able to select multiple inputs, but choosing "algorithm-output" gives me only one pulldown menu.

How do I connect two outputs as input layers (as indicated in yellow)?

example in QGIS graphical modeler showing the UI

I tried using 'Expression' as Input, and there I can select output layers as variables (e.g. @outputX). However I don't know how to use this expression to use multiple variables, either (e.g. @outputX, @outputY gives an error:

Unexpected COMMA where $end was expected

other variations don't work as well, e.g. with space, semi-colon, ...).

5

Change your input back to the 123 Button (="Value-Input"). If you then click on the three dots ... to the right of the input line, you can choose your layers. Here, all layers from your current project are available as well as all algorithm outputs and model inputs.

Indeed, this is a little confusing as "merge vector layers" seems to be the only graphical modeler tool acting this way...

enter image description here

enter image description here

2
  • Correct me if I'm wrong, but imho this can only be configured within the model and not when executing it. So it will only work within a certain project/configuration or anyone who uses the model has to edit the algorithm configuration before model execution. This contradicts the paradigm of considering models as 'black boxes' with only input and output interfaces and whichs content does not matter to the user. – Jochen Schwarze Apr 22 at 11:56
  • I actually find this solution a bit more elegant than using the array in expression. @JochenSchwarze this works as I'd expect, not appearing as input parameters of the model but using temporal results within the model (which of course are not configured as model input). If you want to configure the input when executing the model, use not "temporal algorithm outputs" as input but create input parameters and select those. – Honeybear Apr 27 at 13:14
7

I'm on QGIS 3.18.2, array() works for me. Consider this model:

enter image description here

You are on the right track with expression, in my case it looks like

enter image description here

following the hint "Expected input: an array of layer paths, ...", strange that I couldn't get this to work with string concatenation either (like ... || ';' || ...)

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.