2

When creating models I often first run a toolchain step by step on a small example dataset to test whether each tool does what I want and if I get the desired result. I then use this to build a model, with which I can recreate these steps quickly for any dataset.

There are some algorithms, that take a while to configure. In my example, I'm using "Refactor field" and have a rather complex field configuration (rename this, expression that, change datatype here...) and I want to bake this into the model.

Since I've done the configuration already for my test-setup, I'm a bit annoyed that now I have to manually do it all again in the modeler.

Is there an easy way to copy the configuration of a tool that I ran 1:1 into the modeler?

This is particularily interesting for configurations that usually build on top of input fields. Since the modeler doesn't know, which layer you want to apply a tool to, it doesn't know which values/field names/... to suggest in dropdown menues, making the configuration that has been done before even less convenient. In some cases (e.g. with "refactor field") one can circumvent this, by being able to provide a layer that the configuration table is based on. But this is not always the case. Simply copying and pasting the configuration from a step that already worked would be a great improvement in any case.

I am aware of the possibility to "Copy as Python command" or "Copy as QGIS command". This will include all tool configurations. I think I could create a script of it, and then bind that into the modeler. But I have no experience on whether or how this would work.

Option to Copy as Python command

2
  • Switching to a script gives you a lot more control and flexibility, but you lose the flowchart and GUI. Do you want to keep the graphical model?
    – Andre Geo
    Commented Dec 19, 2023 at 11:22
  • Yes, I'd prefer to (however integrating a script into the graphical modeler would be an option). As a visual person I appreciate the flowchart/GUI aspect. Also I teach GIS and especially when establishing multi-step toolchains, it helps a lot that visualization and functionality go hand-in-hand.
    – Honeybear
    Commented Dec 29, 2023 at 19:31

1 Answer 1

1

Easiest way to do this is to save your tool/setup/configuration as a model, and then incorporate that model into other models. For example, for a specific-use refactoring algorithm, create the desired field mapping in the Model Designer with a simple input and output:

refactor graphical model

The configuration will then be preserved inside this model, and it can be used as a step in a larger model like any other algorithm:

model available in designer

Your Answer

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

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