[GRASS-dev] [GRASS-user] d.rast in python script

Stefan Blumentrath Stefan.Blumentrath at nina.no
Wed Oct 24 01:13:15 PDT 2018

Hi Frank,

My guess is that the GRASS standard parser options [1] (e.g. G_OPT_R_OUTPUT, G_OPT_R_OUTPUTS, G_OPT_V_OUTPUT, ...) would be used in order to determine what has to be / could be added to the map display...

But I am no GUI dev, and cannot tell for sure, hope experts on that part of the code could chime in ...

And yes, I agree that a convenient function in the Python library for adding a map in the currently active layer manager would be a nice new feature (if it does not exist and I just overlooked it)...
Maybe another ticket?...


1: https://grass.osgeo.org/grass74/manuals/parser_standard_options.html

From: Frank David <frank.david at geophom.fr>
Sent: onsdag 24. oktober 2018 09:35
To: Stefan Blumentrath <Stefan.Blumentrath at nina.no>; Nikos Alexandris <nik at nikosalexandris.net>
Cc: Laurent C. <lrntct at gmail.com>; GRASS user list <grass-user at lists.osgeo.org>; GRASS developers list (grass-dev at lists.osgeo.org) <grass-dev at lists.osgeo.org>
Subject: Re: [GRASS-user] d.rast in python script

Hi Stephan,

Thank you for the ticket. One thing seems to me important. Some (of my) scripts can generate numerous rasters and one or two cumulative raster. I don't want to add base rasters but only the few cumulative. If the script GUI have a check box, how to make the choice between these I want to display and those I don't want ?

For my point of view, the use of d.rast inside the script, as we do for all other grass command, should be possible, in order to display what we want to display.


Le 24/10/2018 à 09:23, Stefan Blumentrath a écrit :
Hei Nikos, Frank,

I opened an enhancement ticket, and asked to activate the "Add created map(s) into layer tree" also for addons:
https://trac.osgeo.org/grass/ticket/3686. No idea what changes this would require...

Would that cover your needs, Frank, or do you have a more interactive use in a python script in mind?
You can start a wx monitor (d.mon wx0) and add a map there, but I have not found a way to address the currently active Map Display ...

This would probably require additional function(s) in the Python libraries...?

Maybe this question is better asked at the developer list (thus I put grass-dev in CC).


From: Frank David <frank.david at geophom.fr><mailto:frank.david at geophom.fr>
Sent: onsdag 24. oktober 2018 08:26
To: Nikos Alexandris <nik at nikosalexandris.net><mailto:nik at nikosalexandris.net>
Cc: Stefan Blumentrath <Stefan.Blumentrath at nina.no><mailto:Stefan.Blumentrath at nina.no>; Laurent C. <lrntct at gmail.com><mailto:lrntct at gmail.com>; GRASS user list <grass-user at lists.osgeo.org><mailto:grass-user at lists.osgeo.org>
Subject: Re: [GRASS-user] d.rast in python script

Le 23/10/2018 à 23:26, Nikos Alexandris a écrit :
* Frank David <frank.david at geophom.fr><mailto:frank.david at geophom.fr> [2018-10-23 22:06:01 +0200]:

Thank you everybody for your help. Do you know why a run_command("d.rast"... in a python script is not enough to display a raster ? I don't understand why this command is so different.

Display a raster map where?

In the active map display (and respective Layer manager) as d.rast do it with gui...

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-dev/attachments/20181024/5e4a8d30/attachment.html>

More information about the grass-dev mailing list