[GRASS-windows] d.* commands alternative for scripts?

Glynn Clements glynn at gclements.plus.com
Thu Nov 6 00:23:28 EST 2008


Helena Mitasova wrote:

> The fact that d.* commands are not available in winGRASS
> has been discussed already

The majority of d.* commands are available in WinGRASS; they just
render directly to an image file rather than using a monitor.

The main exception is that commands which rely upon the mouse won't
work. Likewise for scripts which rely upon persistent state (e.g. 
d.frame).

> but I am wondering what can
> be used to display or at least save images in very simple scripts
> (e.g. to automatize doing homework assignments) such as
> this
> 
> http://skagit.meas.ncsu.edu/~helena/lteachtest/GIS_anal_grass/erosion.sh

AFAICT, that could be made to work with direct rendering without too
much trouble. Set GRASS_PNGFILE instead of using d.out.file, and
replace d.rast.leg with separate d.rast and d.legend commands (you can
set GRASS_PNG_READ=TRUE to overlay output on an existing file rather
than replacing it).

> or the version without display is like this
> http://skagit.meas.ncsu.edu/~helena/lteachtest/GIS_anal_grass/erosion_comp.sh
> 
> We have started to use msys cli and simple scripts for some tasks
> and students really like it, especially for their projects
> but automated image output would be a great help. I am wondering whether
> I am missing something here,

Immediate rendering.

If you're using the native Windows version, or using GRASS 7.x, or if
GRASS_RENDER_IMMEDIATE=TRUE, all d.* commands generate (or modify) a
graphics file instead of communicating with a separate monitor
process. This is how gis.m and the wx GUI work.

See the pngdriver (also psdriver, cairodriver) manpages for details of
various environment variables which control the behaviour of d.*
commands.

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


More information about the grass-windows mailing list