[GRASS-user] scripting mapcalc

Glynn Clements glynn at gclements.plus.com
Thu Mar 5 23:37:39 EST 2009

Nikos Alexandris wrote:

> Try this:

> r.mapcalc river="if(river==$old, $new, null())"

Note that this won't work in 7.0, where r.mapcalc uses the parser. It
will complain that r.mapcalc doesn't have a river=... option.

For portability, always:

1. quote the entire expression, and
2. insert a space before the first = sign, e.g.:

	r.mapcalc "river = if(river==$old, $new, null())"

This will work with all versions of r.mapcalc.

Glynn Clements <glynn at gclements.plus.com>

More information about the grass-user mailing list