[GRASSLIST:3389] Re: r.mapcalc reduces my raster map to 255 cats

Glynn Clements glynn.clements at virgin.net
Tue Mar 26 08:34:06 EST 2002


Ben Logan wrote:

> I have some DEMs with 30 meter resolution, and the elevation values
> appear to be in feet instead of meters like the 10 meter res DEMs.  It
> looked like I could convert the feet to meters with r.mapcalc, so I
> ran it with
> 
> elev=elev30/3.28
> 
> as the expression.  It suceeded, but r.info says that my new map
> (elev) only has 255 categories.  The original (elev30) had 2441.  It
> seems to me that I should have the same number of categories...am I
> missing something?

In the above case, r.mapcalc will produce a floating-point map.

Floating-point maps don't really have categories. The values can be
coerced into categories using the map's quantisation rules, but only a
few programs (e.g. r.stats) do this. Most programs just use the exact
floating-point value.

The quantisation rules can be changed with r.quant.

Also, you can force r.mapcalc to generate an integer map using the
"int(...)" operator, i.e.

	r.mapcalc 'elev=int(elev30/3.28)'

I would expect that to have ~745 categories (one for each metre of the
range, rather than one per foot).

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



More information about the grass-user mailing list