Running an external algorithm or command

There are often a bunch of legacy programs or scripts for which there are no resources to port them into another language or framework. Thanks to Python and PyQGIS, it's simple to integrate your existing programs into QGIS.

Running a simple command

We can run an external command in different ways, but we will explore how to do it with the Processing Toolbox that supports the progress bar, which is often useful to log algorithm steps.

To execute an external command, we will follow these steps:

  1. Create a Processing Toolbox script called runping.
  2. Code the script.
  3. Test the script.

Step one is similar to that described in the Creating a test Processing Toolbox script section.

The code of the script is in the following ...

Get Mastering QGIS - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.