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

Patrick Giraudoux patrick.giraudoux at univ-fcomte.fr
Tue Aug 28 00:16:54 PDT 2012


Le 28/08/2012 08:17, Patrick Giraudoux a écrit :
> 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


Sorry to respond to myself, but it looks like I am on the wrong list. I 
was working in GRASS but using QGIS as interface. Using and displaying 
the rasters within GRASS gives results that are absolutely correct. This 
means that the real trouble comes from QGIS reading from GRASS. So will 
move the question to the relevant list.

Patrick


More information about the grass-user mailing list