[GRASS-user] Re: r.mapcalc --> 3 maps

Maciej Sieczka msieczka at sieczka.org
Sun Jan 16 15:49:44 EST 2011

W dniu 16.01.2011 18:29, Gabriele N. pisze:

> A and B do not overlap, and I should take the values of A and B also
> (always). Then.....in areas that are empty, I would then put the values of
> C.
> I tried with    r.mapcalc "output = if((isnull(a)),b,if(isnull(b),a),c)"
> but I lose the values of C

This should work:

r.mapcalc 'd=if(isnull(a),if(isnull(b),c,b),a)'

If map a is null check if b is null too. If so, use c; if not - use b. 
Otherwise use a.


r.mapcalc 'd=if(isnull(a|||b),c,if(isnull(a),b,a))'

If both a and b are null, use c; if a is null use b, otherwise use a.


Maciej Sieczka

More information about the grass-user mailing list