[GRASS-dev] [QGIS-Developer] Accessing GRASS GIS addons from within QGIS

Nikos Alexandris nik at nikosalexandris.net
Tue Feb 19 16:44:58 PST 2019


Dear lists,

following Nyall's recommendation [0],

[0] https://lists.osgeo.org/pipermail/qgis-developer/2019-February/056155.html

a QGIS plug-in [1] adds a provider in QGIS' Processing Toolbox to
expose a GRASS GIS add-on [2].

[1] https://gitlab.com/pmav99/estimap_recreation_qgis
[2] https://gitlab.com/natcapes/r.estimap.recreation

The installation of the/any GRASS GIS add-on, is independent from QGIS
and its Processing framework.  Nevertheless, it would be nice from a UX
point of view, if the plug-in can also install the GRASS GIS add-on
itself.

To perform the installation, the following is required:

1) enter in a GRASS GIS session
2) run `g.extension -a`, parse the output and check if the add-on is installed
3) if the add-on is not installed, then run `g.extension
extension='r.estimap.recreation'`

These steps do not manipulate any data.


Grass7Utils features the following relevant methods [3]:

- `executeGrass`
- `startGrassSession`
- `endGrassSession`

[3] https://github.com/qgis/QGIS/blob/1d8bd004a619cb001cfc469fd42a6f71ecb93888/python/plugins/processing/algs/grass7/Grass7Utils.py#L365-L469

There is, however, no documentation about what the arguments should be.

1. Is this the appropriate way to do this?
2. Is there any documentation or example code?
3. Where would it make sense to "plug-in" this code? Currently,
`Grass7AlgorithmProvider` is subclassed without essential modifications
[4] and it would make sense to keep it this way [5].

[4] https://github.com/qgis/QGIS/pull/9202
[5] https://lists.osgeo.org/pipermail/qgis-developer/2019-February/056155.html

Kind regards, Nikos


More information about the grass-dev mailing list