3

I know I can open the Python Console to type in code, and before I know I've been able to open something in QGIS to see the code running when I do something like intersection vector analysis, though I'm struggling to find this again. Ultimately I'm trying to take the code from a linear set of actions and be able to plug in a few factors for new site data, then let it spit out a coverage map.

2 Answers 2

6

Go to Processing Toolbox, click the History button, then right-click each entry you want and select "Copy as Python Command"

enter image description here

enter image description here

1
  • Thank you this is what I needed. Is there a way to get sequences of non tools? I initially load a map file from OSM by multipolygon (layer > add layer > add vector layer >> multipolygons), then filter the layer with ["building" is not null], which then leaves me with the OSM building footprints. Though I do not see any tools related to this in the processing toolbox to grab the code from. I don't see a way to get this in the Graphical Modeler that was mentioned either.
    – boydo
    Jun 28, 2022 at 4:33
2

from a linear set of actions

This statement here suggests to me you are looking for something along the lines of the Model Designer, which you can then export out to Python.

You can build a linear set of actions in Model Designer (eg: intersect, then buffer, then clip etc). Once you have built the flow, you can export your model out to Python (Model > Export > Export as Python Script).

2
  • I found (Processing > Graphical Modeler), but I'm not seeing Model Designer in my toolbox or elsewhere. What is the path to this tool, or is it a separate download I need to install?
    – boydo
    Jun 28, 2022 at 4:34
  • 1
    Same thing - The menu item is called Graphical Modeler, but after you open it, the Window GUI will be titled 'Model Designer'. Either way, its the same thing :)
    – nr_aus
    Jun 28, 2022 at 7:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.