[GRASS-user] Use variables in GUI?

Hamish hamish_b at yahoo.com
Sat Sep 25 02:59:35 EDT 2010


Richard wrote:
> Being more a scripter than a programmer, I suspect
> g.pnmcomp is beyond me ... I can't really see how to pass a
> map to the module, and can't really find any examples to help.

#spearfish example:
r.shaded.relief map=elevation.dem shade=elev.shade

g.region rast=elev.shade
d.mon x0
d.resize # ...


d.erase 
d.rast elev.shade
d.out.file -t output=background format=ppm

d.erase
d.rast -o fields
d.out.file -t output=overlay format=ppm


d.erase
d.vect roads
d.out.file -t output=foreground format=ppm


d.erase
d.legend -c fields thin=4
d.barscale at=62.5,94
d.out.file -t output=decorations format=ppm


g.pnmcomp input=background.ppm,overlay.ppm,foreground.ppm,decorations.ppm \
   mask=background.pgm,overlay.pgm,foreground.pgm,decorations.pgm \
   output=merged.ppm outmask=merged.pgm  opacity=1,0.5,1,0.8 \
   width=`d.info -d | cut -f2 -d' '` height=`d.info -d | cut -f3 -d' '`

#from netpbm tools, see also the man page for 'pnmcomp'
pnmtopng merged.ppm > merged.png


(GRASS's g.pnmcomp is rather poorly documented)


> So here's what I would like (ideally) a script to do:
> 
> 1. set a variable (eg state)
> for i in NSW QLD VIC; do
> g.region vect=$i
> 
> 2. Load gis.m with a .grc file
> gis.m dmrc=Mymaps.grc

use d.* instead,

> 3. Pass $i to the "where" variable in a vector.
> 
> 4. Zoom to the region.
> 
> 5. Output the image to $i.png
> 
> 6. Quit gis.m for the next state.
> 
> Is it feasible?

technically you could set up a gis.m .grc file from a script,
it's just a text file.. but I think you can do all you want 
with a script like the above, or just with 'd.shadedmap' +
d.out.file if the only transparency you want is between 2 raster
maps. (but it sounds like you want it for vectors..)



Hamish



      


More information about the grass-user mailing list