How can I run the graphic modeler from the python console in QGIS?
2 Answers
- If you want how to run your own model with its parameters, first, open and run the model by Processing Toolbox. Then open
Processing > History
window and the last process shows how you can run the model. Select it and copy/paste into Python Console.
If you want to open Graphical Modeler window by Python Console, try this:
from processing.modeler.ModelerDialog import ModelerDialog dialog = ModelerDialog() dialog.show()
-
I tried to follow your instructions, but my models do not show up in the processing history. Other algorithms (e.g. native:...) do show up. Do you happen to know a reason for this?– ValiCommented Sep 23, 2020 at 9:05
-
I have no idea. My model appears in processing history after running the model. It may be a bug. Commented Sep 23, 2020 at 9:12
If you enter:
import processing
processing.alglist()
In your python console you'll get a list of all available algorithms, and the appropriate syntax to call them. Models are just a kind of algorithms and you can run them with:
processing.runalg('modeler:modeler_name', arg1, arg2 ...)
-
Is there an easy way to add a new algorithm to the list of the algorithm? Commented May 28, 2019 at 11:29