[Qgis-user] PYQGIS Algorithm Dev Environments?

Ujaval Gandhi ujaval at spatialthoughts.com
Sun Jul 25 20:41:19 PDT 2021


What you are looking for is 'Processing Algorithms' or 'Processing
Scripts'. When you write a new algorithm using the Processing Framework,
the algorithm is available in the Processing Toolbox and can be used in
models, batch processing, or standalone tool. QGIS also includes a
'qgis_process' tool that can execute processing algorithms from
command-line without launching the qgis gui.

You can also write a standalone pyqgis script that can be run on
servers/headless mode without QGIS GUI.

For dev environments, you can use PyQGIS with Pycharm, VSCode, Jupyter etc.
by setting your paths correctly. You can also install QGIS using conda and
use it from the conda environment (which removes the hassle of setting
python paths)

 Sharing some resources

Writing Processing Scripts
https://docs.qgis.org/3.16/en/docs/user_manual/processing/scripts.html
qgis_process tool:
https://bnhr.xyz/2020/07/17/run-qgis-algorithms-command-line.html
writing standalone pyqgis scripts
https://courses.spatialthoughts.com/pyqgis-in-a-day.html#writing-standalone-python-scripts
VSCode PyQGIS setup https://gis.stackexchange.com/a/330646/5160
QGIS with Conda
https://gisunchained.wordpress.com/2019/05/29/using-qgis-from-conda/


[image: Logo] <https://spatialthoughts.com/>
Ujaval Gandhi
Spatial Thoughts
mobile: +91-8095684687
email: ujaval at spatialthoughts.com
[image: LinkedIn icon] <https://www.linkedin.com/in/spatialthoughts/>  [image:
Twitter icon] <https://twitter.com/spatialthoughts>



On Mon, Jul 26, 2021 at 8:31 AM Andrew Hughes <ahhughes at gmail.com> wrote:

> Hi All,
>
> I've spent the best part of the morning trying and getting nowhere working
> out the following when developing python algorithms
>
> In order of priority, my questions are - How can I...
>
> Q: develop+run/debug algorithms in VSCode?
> Q: run the python algorithm on the command line (without starting the QGIS
> GUI) - this is for automation (non-human) driven execution?
> Q: display the algorithm in the QGIS processing panel, and execute it -
> for human driven execution.
> Q: incorporate the algorithm in QGIS processing models?
>
> I am hoping there is an online guide or public project I have not been
> able to find yet that someone can point me to.
>
> For reference: I'm trying to process large volumes of data that I would
> like to 'migrate' across to openstreet map exports. Given the size of the
> data, I feel like I need to start writing bespoke algorithms that will
> iterate feature-by-feature and have more control over what is happening
> during the execution.
>
> Many thank in advance
> Andrew
> _______________________________________________
> Qgis-user mailing list
> Qgis-user at lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20210726/cd3380cb/attachment.html>


More information about the Qgis-user mailing list