1

When writing your own scripts, and using some of the pre-fab tools how do you make the output load automatically into your QGIS project?

Example: In the Help Tab of the QGIS tool "saveselectedfeatures" it explains its "Console Usage" as follows:

processing.runalg('qgis:saveselectedfeatures', input_layer, output_layer)

But when you run it as its own tool from the Toolbox the GUI has you fill in the same two parameters, but also has a third: a checkbox for "Open output file after running algorithm". I checked it and it showed up as promised on my map project.

But the Tool's own HELP tab says nothing about how to script this functionality.

So how do I make the output open in the project automatically?

  • As mentioned in a previous comment to another question of yours, you can replace runalg with runandload. Or do you still have issues with this? – Joseph Oct 30 '15 at 12:17
  • No issues remaining @Joseph, but I was advised to separate this question into its own designated post to be in keeping with the recommended "one question per question". Thanks. – Waterman Oct 30 '15 at 14:35
1

The answer is to replace 'runalg' with 'runandload' (as suggested by @Joseph).

We're looking for long answers that provide some explanation and context. Don't just give a one-line answer; explain why your answer is right, ideally with citations. Answers that don't include explanations may be removed.

  • Does this question require a longer answer or explanation? I feel the context is fully given in the question wording, complete with relevant code. The answer is quite simply to replace 'runalg' with 'runandload'. I referenced the person who supplied the solution, "@Joseph", in my answer. Otherwise I am genuinely confused about what you mean by citations. – Waterman Oct 23 '17 at 20:38

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.