[GRASS-user] 0, null values and raster algebra

Patrick Giraudoux patrick.giraudoux at univ-fcomte.fr
Mon Aug 27 23:17:43 PDT 2012


Hi,

I have some troubles managing 0, null values and r.colors. I just want 
to extract a particular habitat category from a Global Land Cover 2000 
raster into a raster of presence/absence (and NULL value for ocean and 
waterbodies)

This makes the following:

r.mapcalc "V7_01=if(AsiaGLC2000==7,1,0)"

So far so good, I get a raster V7_01 with null values and 1 for pixel of 
category 7, 0 for the others and null values stay NULL

Now, I would like to transform V7_01 into a floating point map, and then 
use r. neighbors for a neigborhood analysis.

r.mapcalc "V7=1.0*V7_01"

I get a raster named V7 BUT strangely for any color table, 0 value is 
considered NULL (transparent). The original NULL values are well kept 
and distinct in  this raster (e.g. NULL pixels are informed as NULL and 
0 pixels are 0, respectively)

Any suggestion welcome, I am stuck...

Patrick


More information about the grass-user mailing list