[GRASS-user] r.mapcal sintax error

Markus Neteler neteler at osgeo.org
Sat Apr 11 16:37:57 EDT 2009


On Sat, Apr 11, 2009 at 10:29 PM, Margherita Di Leo <diregola at gmail.com> wrote:
> Markus Neteler wrote:
>> On Sat, Apr 11, 2009 at 10:00 PM, Margherita Di Leo <diregola at gmail.com>
...
>> r.mapcalc "basin_10m_2=if(basin_10m==24, 28, null())"
>> r.mapcalc "basin_10m_3=if(basin_10m==26, 28, null())"
>>
>
> the matter is that i don't want to replace the whole map with null value , i
> only want to replace 24 and 26 with 28 and preserve the other values of the
> map.

Sure, then (to preserve, use the map name):

r.mapcalc "basin_10m_2=if(basin_10m==24, 28, basin_10m)"
r.mapcalc "basin_10m_3=if(basin_10m_2==26, 28, basin_10m_2)"

or simply

r.mapcalc "basin_10m_2=if(basin_10m==24 || basin_10m==26, 28, basin_10m)"

Markus


More information about the grass-user mailing list