display in grass7 [was: Re: [GRASS-dev] r.watershed]

Glynn Clements glynn at gclements.plus.com
Sat Jan 24 10:24:19 EST 2009


Markus Neteler wrote:

> >> >> P.S. I often do grass stuff from home over the net. For grass7 display
> >> >> through gui, even clicking off or changing
> >> >> the names of layers is rather time consuming compared to d.rast with x0 (I
> >> >> have cable).
> >> >> Any hints, tricks on how to display maps fast when testing would be
> >> >> appreciated.
> >> >
> >> > You could try ximgview. See [1] for Glynn's explanations of how it works.
> >> >
> >> > I have also successfully used gqview as my viewer (just point it to map.png
> >> > and it gets updated automatically).
> >>
> >> Could you wrap this up into some d.mon command? Would be cool
> >> unless there is a wx based monitor system.
> ...
> 
> I tried the suggestion had success after changing USR1 to SIGUSR1:

The argument to "kill" should be either a signal number or a signal
name. According to POSIX, signal names shouldn't have the "SIG"
prefix. The GNU version of "kill" and the bash built-in version both
accept signal names with or without the "SIG" prefix.

http://www.opengroup.org/onlinepubs/009695399/utilities/kill.html

> cat d.mon
> #!/bin/sh
> 
> export GRASS_PNGFILE=/tmp/grass7map.bmp
> export GRASS_PNG_MAPPED=TRUE
> d.erase # create the file
> export GRASS_PNG_READ=TRUE
> ximgview map.bmp percent=0 &
> export GRASS_NOTIFY='kill -SIGUSR1 `pidof ximgview`'
> # d.* commands follow

Note that the d.* commands would have to be contained in the script,
as the "export" commands only affect the environment of commands which
are run from the script; they won't affect the environment of the
shell (or other process) from which the script is run.

It isn't possible for one process to change the environment of another
existing process, so you can't write a script which will change the
environment of the shell from which it is run.

However, you could "source" the above script from bash (or any Bourne
shell). That will cause the commands to be executed by the shell
itself, rather than in a child process. That approach can't be used
from e.g. Tcl/Tk or Python, though.

-- 
Glynn Clements <glynn at gclements.plus.com>


More information about the grass-dev mailing list