[GRASS-dev] Shell scripts

Glynn Clements glynn at gclements.plus.com
Tue Dec 1 05:43:00 EST 2009


Michael Barton wrote:

> Right now, you can set the following environment variables and run any  
> d.* command to have an output file created of the map to be displayed.
> 
> GRASS_PNG_AUTO_WRITE = TRUE
> GRASS_PNG_READ =FALSE
> GRASS_TRUECOLOR = TRUE
> GRASS_RENDER_IMMEDIATE = TRUE
> GRASS_WIDTH  = [value]
> GRASS_HEIGHT = [value]
> 
> GRASS_CAIROFILE = [outputfile]
> GRASS_PNGFILE = [outputfile]

Also, if you want each image to be overlaid upon the previous one
(like with the monitors), you can set GRASS_PNG_READ=TRUE once the
output file has been created. This causes each d.* command to start
with the "screen" initialised from the contents of the output file
(which must exist, and have the correct dimensions).

The same approach could be used by the GUI to skip the g.pnmcomp step
(provided that all layers have 100% opacity).

If you have an image viewer which can handle 32-bpp BMP files, you can
use GRASS_PNGFILE=map.bmp and GRASS_PNG_MAPPED to cause the file to be
mmap()d as the frame-buffer, which saves having to read and write the
file.

A suitable (although rather primitive) viewer is available as
visualisation/ximgview. This will refresh its display from the file
either at regular intervals, or when it receives SIGUSR1. If the
environment variable GRASS_NOTIFY exists, its value will be executed
via system() whenever a d.* command completes, so you can use e.g.:

	export "GRASS_NOTIFY=kill -USR1 `pidof ximgview`"

to force the display to be redrawn after each command.

Possibly even faster would be to use the cairo driver to render into
an existing X Pixmap.

> On the other hand, if these folks DO want to use the wxPython GUI (and  
> all the interactive tools on the canvas) but simply want to be able to  
> get maps displayed in the canvas by typing commands instead of adding  
> them to the layer manager, then I think the better way to go is to  
> enhance the wxPython console. This solution could be of interest to  
> power users on all platforms.

No matter how much functionality is buit into the wxPython console,
there will still be cases where it would be useful to control the GUI
using external commands (analogous to e.g. "firefox -remote ..." or
gnuclient for XEmacs).

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


More information about the grass-dev mailing list