[GRASS-dev] new r.out.gdal fails to preserve 8bit color

Glynn Clements glynn at gclements.plus.com
Sat Jan 20 19:08:26 EST 2007


Markus Neteler wrote:

> On Fri, Jan 19, 2007 at 03:31:42PM +0000, Glynn Clements wrote:
> > 
> > Markus Neteler wrote:
> > 
> > > > Why do you think that this is an issue with G_get_f_color_rule()?
> > > >   
> > > Maybe that's a wrong assumption.
> > > 
> > > > With a simple test program, I get results which exactly match the
> > > > contents of the colr file.
> > > >   
> > > 
> > > I tried on two machines. The exported file does not contains colors. I wonder
> > > if you get a colored output file (did you try a Spearfish raster map?).
> > 
> > I haven't looked into the overall issue of colour tables in r.out.gdal
> > (I'm entirely unfamiliar with the GDAL API), only the question of
> > whether G_get_f_color_rule() works correctly (it appears to).
> 
> Right, it writes reasonable values (in my debug output).
> So GDALSetMetadataItem() probably fails or something else is
> missing.

Based upon ~5 minutes of looking at the GDAL code and gdal.h, I
suspect that you need GDALSetRasterColorTable(hBand, hCT) in there
somewhere. AFAICT, you're creating a colour table, and filling in the
entries, but not actually using the completed colour table for
anything.

BTW, hCT should be GDALColorTableH rather than GDALColorTableH*;
GDALColorTableH is already a pointer.

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




More information about the grass-dev mailing list