[GRASS-user] Probably a stupid question: r.mapcalc display colours

Hi,

I'm using r.mapcalc to clip white areas out of some rasters.

The clipping works fine, but the new map displays in different colours to the old map, even though the pixels have the same values as the old map. Why is this?

Cheers,
Richard Chirgwin

On 12/06/11 09:09, Richard Chirgwin wrote:

Hi,

I'm using r.mapcalc to clip white areas out of some rasters.

The clipping works fine, but the new map displays in different colours
to the old map, even though the pixels have the same values as the old
map. Why is this?

r.mapcalc probably just assigns the default color table. Just use r.colors map=NewMap raster=OldMap to assign the color table of the old map to the new map.

Moritz

On 12/06/11 9:32 PM, Moritz Lennert wrote:

On 12/06/11 09:09, Richard Chirgwin wrote:

Hi,

I'm using r.mapcalc to clip white areas out of some rasters.

The clipping works fine, but the new map displays in different colours
to the old map, even though the pixels have the same values as the old
map. Why is this?

r.mapcalc probably just assigns the default color table. Just use r.colors map=NewMap raster=OldMap to assign the color table of the old map to the new map.

Moritz

Moritz,

I *knew* it was probably a stupid question! :slight_smile:

Many thanks, that was exactly the fix.

Richard

Moritz Lennert wrote:

> I'm using r.mapcalc to clip white areas out of some rasters.
>
> The clipping works fine, but the new map displays in different colours
> to the old map, even though the pixels have the same values as the old
> map. Why is this?

r.mapcalc probably just assigns the default color table.

Except for one specific case[1], r.mapcalc doesn't assign any colour
table. The library (libgis in 6.x, libraster in 7.0) provides a
default colour table (rainbow) for any map which lacks one.

[1] The specific case is for an expression of the form
"newmap = oldmap", in which case it will copy the colour table and
categories.

--
Glynn Clements <glynn@gclements.plus.com>