[GRASS-user] Complex operations with r.mapcalc

Markus Neteler neteler at osgeo.org
Tue Mar 31 17:10:13 EDT 2009

On Tue, Mar 31, 2009 at 4:21 PM, fulvio <fulvio.mastrogiovanni at unige.it> wrote:
> Hi everyone,
> I am requested to produce a new raster map from already available ones, with the purpose of ranking each cell according to some criteria, e.g., beauty. For instance, if a given cell contains vegetation, this should increase this ranking.
> It seems appropriate to use r.mapcalc. However, what is unclear to me is how to sum up all contributions from the various maps, discriminating between categories within the single raster map.
> Could you provide me with an example of this?

I think that this is easiest solved with the eval() function of r.mapcalc.
See for example the r.shaded.relief script in the scripts/ directory for
usage of eval(). It permits to define tmp variables on the fly and compose
a series of conditions and calculations into one r.mapcalc instruction.

Hope this helps

More information about the grass-user mailing list