4

I try to merge two outputs in a QGIS Model Designer model. How can I add two input layers to the Merge vector layer algorithm? There's only one field for input layers (see screenshot). I tried to add "the other" input as a dependency. Also, I tried to add both inputs there. In none of the versions I tried, the result contained both inputs.

Model designer Screenshot

It only works for me when I export the model to Python and create a list of the input layers.

# Merge vector layers
layerlist = [outputs['CreateSpatialIndex_clip']['OUTPUT']]
layerlist.append(outputs['CreateSpatialIndex_difference']['OUTPUT'])
alg_params = {
 'CRS': QgsCoordinateReferenceSystem('EPSG:2056'),
 'LAYERS': layerlist,
 'OUTPUT': parameters['Av_parzellen_oberwallis_lnnichtln']
}
outputs['MergeVectorLayers'] = processing.run('native:mergevectorlayers', alg_params, context=context, feedback=feedback, is_child_algorithm=True)
results['Av_parzellen_oberwallis_lnnichtln'] = outputs['MergeVectorLayers']['OUTPUT']
return results
Taras
35.7k5 gold badges77 silver badges151 bronze badges
asked Dec 29, 2021 at 19:10

1 Answer 1

4

I just came across this very relevant question/issue/challenge, that I manage to solve.

The trick is to select the "value" option under "Input Layers".

Value option under Input Layers

Then select the layers you want to input for the merging (on the right, the three dots), it will be named in this case: "Create spatial index_Clip" and "Create spatial index_Difference".

enter image description here

answered Sep 9 at 9:46

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.