[GRASS-user] v.to.rast shell script

Hamish hamish_b at yahoo.com
Fri Sep 19 21:45:00 EDT 2008


John  Tull wrote:
> I was wondering if anyone could suggest a simple shell script to  
> automate the process of running v.to.rast on all layers in
> a single vector in GRASS?

sure, just a bash for loop + g.mlist will do it:

for MAP in `g.mlist vect` ; do
   echo v.to.rast in="$MAP" out="`echo $MAP | tr '[:lower:]' '[:upper:]'`"
done

in that example the other v.to.rast options would have to be constant of
course.

To avoid mistakes I like to capitalize a map name if it is going to be
both a vector and raster map. Probably there is some simple sed command
to just do the first character. otherwise just use "out=$MAP".



Hamish



      



More information about the grass-user mailing list