2

I want to run a model with a python script, including the parameters, because I can't "translate" the model easily into a script.

I have tried to run a copy of the processing log after running the model, (from the console and the editor):

processing.run('model:myModel', {'form1':'P:/Form1.xlsx','form2':'P:/Form2.xlsx','form3':'P:Form3.xlsx','coordinatesystem':QgsCoordinateReferenceSystem('EPSG:25832'),'native:mergevectorlayers_4:Border 1':'memory:','native:mergevectorlayers_6:Border 2':'memory:','native:mergevectorlayers_7:Cirlces':'memory:','qgis:createpointslayerfromtable_1:Baum':'memory:'})

Something happens, but the layers do not show up. I tried F5 but nothing changed.

I have found this piece of information, but it is for QGIS2

How to run the graphic modeler from the python console in QGIS?

How can I trigger the execution of a model with its parameters in pyGIS and get the layer window updated?

  • Try replacing processing.run(...) with processing.runAndLoadResults(...) – Joseph Jul 18 at 9:57
  • Thank you Joseph, that solved my problem! I got one more question which I believe is related to my original question: What if the model is not yet part of the QGIS-project, but instead a file in some folder. How would I go about changing the 'model:myModel' into a file path? – GISme Jul 18 at 14:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.