[GRASS-user] scripting mapcalc
achim
ak7 at jupiter.uni-freiburg.de
Thu Mar 5 09:42:35 EST 2009
Hi,
did someone tried -like me- to use r.mapcalc in a script inside an
do-while-clause?
I cannot pass changing variables $old, $new like:
r.mapcalc 'river=if(river=$old,$new,null())'
its because of the '', which are needed because if the if-statement.
I failed passing the hole statement eg. 'river=if(river=5,4,null())' as
a variable like:
r.mapcac $statement
...
I tried many things and some shells (bash,csh,tcsh)...
I think its because the ''. Besides when it seemed do be expressed the
right way I got this answer:
r.mapcalc 'river=if(river=4032076,4032075,null())' <-debugging output
syntax error, unexpected $end, expecting '='
Parse error
or
syntax error, unexpected '=', expecting ')'
Parse error
or
Ungültiger Dateiname. Das Zeichen <=> ist nicht erlaubt.
Ungültige Karte <if(river=4032076,4032075,null())>
Parse error
depending on what I tried.
Can someone help?
Or is there another (and faster) way to query raster-data without
writing a C-Program?
I'd like to do it inside grass. Otherwise I would export the map to
octave to calculate there, but its not the gentle way I think.
Thanks,
achim
More information about the grass-user
mailing list