1

I am trying to run the qgis merge vector layers tool in a standalone script however I am getting the following error:

Unable to execute algorithm
Wrong parameter value:/Users/jt/workspace/Manna/workflow/mesh.shp;/Users/jt/workspace/Manna/utm/CW_roads_clean.shp

I first ran the tool normally and then copied the code out of the history. I have also successfully ran the code in the qgis python console. It is just when I try to run it in the following stand alone script that it has issues.

import sys
sys.path.append('/Applications/QGIS.app/Contents/Resources/python/plugins')

from qgis.core import *
from PyQt4.QtGui import *
import processing
from processing.core.Processing import Processing

app = QApplication([])
QgsApplication.setPrefixPath("/usr", True)
QgsApplication.initQgis()
Processing.initialize()
Processing.updateAlgsList()

processing.runalg("qgis:mergevectorlayers",
    "/Users/jt/workspace/Manna/workflow/mesh.shp;/Users/jt/workspace/Manna/utm/CW_roads_clean.shp",
    "/Users/jt/workspace/Manna/ten_meter/temp_merge.shp")
1

The problem ended up not being with running the algorithm but instead the layers were not valid. I had the wrong prefix path; it should have been: QgsApplication.setPrefixPath("/Applications/QGIS.app/Contents/MacOS", True)

0

Try with this:

layer_merge= processing.runalg('qgis:mergevectorlayers', '/Users/jt/workspace/Manna/workflow/mesh.shp','/Users/jt/workspace/Manna/utm/CW_roads_clean.shp', None)
processing.runandload("qgis:dissolve", layer_merge['OUTPUT'], True, '', "/Users/jt/workspace/Manna/ten_meter/temp_merge.shp")
1
  • The first line gives an error: Error: Wrong number of parameters I also tried it combining the two input files separating them with a semicolon but that gave me the same error as my original code. – James Jan 2 '18 at 11:36

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.