[GRASSLIST:5630] Re: cat labels in mapcalc

Glynn Clements glynn.clements at virgin.net
Fri Feb 21 09:10:21 EST 2003


orkun wrote:

> I want to use cat labels instead of cat values in r.mapcalc
> To create a new map from existing map's one category label
> I tried this expression: 
> r.mapcalc dene='if(@f28hey_cat=="R",1,0) # (R is cat label from f28hey_cat.)

r.mapcalc doesn't have a string type, and the "@" operator is only
valid if the category labels are numbers.

The above expression is equal to 1 if the category label from the map
"f28hey_cat" is equal to the cell value from the map "R". Double
quotes simply force a sequence of characters to be interpreted as a
map name.

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




More information about the grass-user mailing list