Automating r.colors and r.neighbors?

Jane Rossing rossing at
Fri Nov 5 10:01:52 EST 1993

I have what I imagine is a simple question:

Can someone give me an idea how to make a simple script for using
r.colors and/or r.neighbors?

For r.colors, the statement suggested in the manual is 'cat rulesfile |
r.colors map=map color=rules.  Easy enough, but if I want to set a large 
number of maps to my rules file, I need to put it in a little script 
which would perhaps read 'map=$1' so I don't have to type the whole
line each time.

For r.neighbors, the statement is 'r.neighbors input=map output=map
method=method size=size.  Here again, it doesn't allow me to put
in input=$1 output=$2, for example.

After much struggle, I figured out from  looking at other people's scripts
that r.mapcalc will take arguments if you write 'echo "map=expression"|
r.mapcalc.  I hope there is such a simple solution for r.colors and r.neighbors, but I can't seem to find it.

Thanks for your suggestion.

Jane Rossing
rossing at

More information about the grass-user mailing list