[GRASSLIST:425] Re: Maximum number of colors in rasters

Hamish hamish_nospam at yahoo.com
Mon Mar 27 10:41:36 EST 2006


> I guess this is a two-part question: 1) What is the maximum number of
> colors representable in an x-monitor/tcltk canvas, and 2) How many
> colors are stored in a raster color table from a raster that was
> gridded within Grass (i.e., xyz data)


d.info -c
  or
d.mon start=x1
  should tell you the number of colors used in a x monitor

$MAPSET/colr/$MAP  holds the color rules. Usually color is interpolated
from a few set tie points. e.g.  0% black   4 red    100% blue
see the r.colors help page.


Wild guess as to why you are asking this:
your output looks like it has like 256 contoured bands when you think it
should be (perceivably) continuous. try this:

r.mapcalc 'elev_int=int(elev)'
r.colors elev_int rast=elev   # maybe redundant
d.rast elev_int

[mult the DCELL map by 10000 before int() if decimal places are significant]


is it now smooth?

For some reason I don't understand, floating point maps don't do smooth
color transitions. On the other hand I have used this "feature" on
occasion to enhance a raster map hardcopy (sometimes you want the subtle 
contour lines).

I tried to document this ~1-2 years ago I think. If interested search
through the mailing list archive or the bug tracker for the post.
commonly seen: scale a lat/lon SRTM map to 1:1:1 XYZ for NVIZ by dividing
elev map by 60*1852. set some colors with r.colors and then d.rast both 
original CELL and new DCELL maps.


or maybe you are seeing big white splotches? do this:
r.color map rules=rainbow

anything beyond the color rules' range gets turned white; sometimes the 
map range is increased but the colors file is taken from a narrower
map.


Hamish




More information about the grass-user mailing list