[GRASSLIST:4829] Re: r.mapcalc magic

Glynn Clements glynn.clements at virgin.net
Fri Oct 25 06:02:30 EDT 2002


Rado Bonk wrote:

> My raster map consists of individual discrete pixels and NULL values
> around them (map is the results of s.to.rast command). Since I need to
> reproject the map (using i.rectify) I have to change all the NULL
> values into to "9999" (or other arbitrary value, zero is also 
> acceptable). It's because the i.rectify somewhat doesn't produce results 
> using NULL maps as input.
> 
> I tried to do that with r.mapcalc, with the following result:
> 
> GRASS:~ > r.mapcalc sitmap1 = 9999 + if(isnull(sitmap),0,sitmap)
> bash: syntax error near unexpected token `if(i'
> 
> Where is the problem?

Put quotes areound the expression to prevent it from being interpreted
by the shell.

> Other thing, I expected r.support to replace the NULL
> values with "zero" when choosing the appropriate option, but it doesn't
> work.

Use r.null, e.g. "r.null null=9999 ...".

-- 
Glynn Clements <glynn.clements at virgin.net>



More information about the grass-user mailing list