Skip to main content
2 of 3
changed "above" into "@Joseph" as the answers change position depending on score
gisnside
  • 7.9k
  • 2
  • 32
  • 74

Since trying @Joseph's answer causes an exception (l1 and l2 are both of type QgsVectorLayer, QGIS 2.18.17 Python console)

import processing
[...]
processing.runalg('qgis:mergevectorlayers', l1 + ";" + l2, None)
Traceback (most recent call last):
    File "<input>", line 1, in <module>
TypeError: unsupported operand type(s) for +: 'QgsVectorLayer' and 'str'

I've been trying

>>> merged = processing.runalg('qgis:mergevectorlayers', [l1, l2], None)
>>> merged['OUTPUT']
u'C:\\Users\\Jochen\\AppData\\Local\\Temp\\processing30eee19448ef42a497403dd3660cafcf\\82e112158f194f59a53e18d5020a9a9d\\OUTPUT.shp'

successfully.

So passing <ParameterMultipleInput> as a python list is a solution to this.

Jochen Schwarze
  • 14.9k
  • 8
  • 54
  • 120