[GRASSLIST:4253] Re: r.in.gdal help

Glynn Clements glynn.clements at virgin.net
Thu Aug 8 12:11:38 EDT 2002


Markus Neteler wrote:

> > > I am having a little trouble (again) with the r.in.gdal.  Currently, I
> > > am trying to import an erdas img file.  It comes in fine, however, it
> > > breaks it up into 3 separate files.  The file is supposed to be a map of
> > > somesorts.  Any idea on how to recreate this??  Thanks....
> > 
> > Does it break it up spatially, or into R/G/B colour channels?
> > 
> > If it's broken up into colour channels, you can generate a composite
> > map using r.composite. However, depending upon what you're planning to
> > do with it, it may be better to leave it as three separate channels. 
> > Generating a composite map may either lose information, or create a
> > massive number of categories (and an equally massive colour table), or
> > a combination of both.
> 
> Short addition: a massive number of categories (and an equally massive
> color table) will slow down the map display *significantly*. The
> magic number is around 8000 colors, with more than 8000 colors you
> face a speed problem for that particular map. Since 8000 colors are
> far from 24bit, it's better to keep the channels separated and
> compose them on the fly for visual purposes only.
> 
> d.rgb and r.composite use per default less than 24bit.

1. d.rgb doesn't generate a composite map any more (which is why it
lost the option to save the composite map). It uses R_RGB_raster(),
which sends 24-bpp data to the monitor. The monitor will display the
raster at the colour resolution of the display (i.e. if you're running
on a 24-bpp display, you will get full 24-bpp colour resolution from
d.rgb).

2. The raster's colour table isn't quite as massive as the number of
categories. r.composite uses colour rules rather than individual
colour entries, so the colour table only has N^2 entries rather than
N^3 (where N is the number of levels per channel; 24-bpp data is 256
levels per channel, which would result in 65536 colour rules).

However, if you display the resulting composite map with d.rast,
d.rast will generate a paletted corresponding to a sampled colour
cube. To limit memory consumption, the palette is limited to 32768
entries (15-bpp, 5 bits per channel, 32 levels).

Consequently, it's preferable to keep R/G/B image data as three
separate bands. Such maps can be displayed with d.rgb, printed using
ps.map's "rgb" command, and exported to a PPM file with r.out.ppm3.

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



More information about the grass-user mailing list