[Gdal-dev] r.out.gdal: SetColorInterpretation() not supported
Markus Neteler
neteler at itc.it
Tue Jan 16 12:22:57 EST 2007
On Tue, Jan 16, 2007 at 11:42:47AM -0500, Frank Warmerdam wrote:
> Markus Neteler wrote:
> >Hi,
> >
> >for some weeks we have a nice C implementation of r.out.gdal
> >in GRASS, but a color table problem remains:
> >
> >GRASS 6.3.cvs (spearfish60): > r.out.gdal fields out=fields.tif
> >ERROR 6: SetColorInterpretation() not supported for this dataset.
> > 100%
> >Done!
> >
> >GRASS 6.3.cvs (spearfish60): > r.info -t fields
> >datatype=CELL
> >
> >GRASS 6.3.cvs (spearfish60): > r.info -r fields
> >min=1
> >max=63
> >
> >The (probably) relevant line in the main.c file is:
> > /* Set color interpretation. TODO: Implement this better ... */
> > GDALSetRasterColorInterpretation(hBand, ((band + 3) % 4 +
> > GCI_RedBand));
> >
> >Maybe it fails on an 8 bit range?
> >
> >Suggestion are welcome as colorized export is an important thing,
>
> Markus,
>
> The GeoTIFF driver provides very little post-creation control over band
> color interpretations. The actual implementation only supports marking
> band 2 or 4 of a greyscale or rgb file as alpha. All other efforts are
> essentially passed on to the generic implementation which produces the
> error you see.
>
> That doesn't necessarily mean the color interpretation is set wrong, though
> it could.
>
> I would add that most other drivers also have no meaningful implementation
> of this method.
>
> My suggestion is to call:
>
> CPLPushErrorHandler( CPLQuietErrorHandler );
>
> just before calling GDALSetRasterColorInterpretation() and then:
>
> CPLPopErrorHandler();
>
> just afterwards. This will at least supress the confusing message.
>
Frank,
in fact the message is right since the result does not contain
color (which is essentially my problem). I also tried the HFA
driver to no avail.
In summary: the resulting file becomes grey scale.
Best,
Markus
PS: Using today's SVN
More information about the Gdal-dev
mailing list