[gdal-dev] [GRASS-user] r.out.gdal export with color table for
dassau at gbd-consult.de
Tue Aug 2 06:02:05 EDT 2011
Am Mon, 01 Aug 2011 16:24:23 +0200
schrieb Even Rouault <even.rouault at mines-paris.org>:
> > > Hi,
> > >
> > > I have an elevation map in GRASS with a color table that distinguishes
> > > decimal values based on the srtm color table, see below. I only want to
> > > have the value 0 in aqua, and all values <> 0 shall reflect land below
> > > or above sea level.
> > >
> > > -10 57 151 105
> > > -0.000001 57 151 105
> > > 0 aqua
> > > 0.000001 57 151 105
> > > 50 117 194 93
> > > 100 230 230 128
> > > 200 202 158 75
> > >
> > > When I export the raster with r.out.gdal (nor now I used GeoTiff and
> > > ERDAS Img) the color table seems to be changed to reflect "only"
> > > integer values. so all 0 floating point values are displayed as aqua.
> > >
> > > Is there a solution for this?
> > >
> > > Thanks a lot
> > > Otto
> > Hi,
> > fowarded from grass list, because it is probably better here with some
> > additional notes:
> > I used Float32 as data type for the export to ERDAS Img, so the data a
> > floating point and there is a color table but the colortable does not
> > reflect the floating point data.
> > Color Table (RGB with 174 entries)
> > 0: 0,191,191,255
> > 1: 58,151,105,255
> > 2: 59,152,105,255
> > 3: 60,153,105,255
> > 4: 61,154,105,255
> > 5: 62,155,104,255
> > 6: 64,156,104,255
> > Is it possible somehow to adjust the colortable after the GRASS export
> > to get a color table that distinguishes floating point values as it does
> > in GRASS?
> In the GDAL data model, the index of a color table is necessary a
> (positive) integer. So there's no direct way to translate the GRASS color
> table of a floating point band into a matching GDAL object.
> There are several workarounds you could try :
> * put your color table in a text file that can be used for example by
> "gdaldem color-relief" . See http://gdal.org/gdaldem.html
> * build a Raster Attribute Table from the color table and set it to the IMG
> dataset. But be aware that R.A.T. are rarely exploited by GDAL utilities.
> Best regards,
Thanks a lot Even for your help,
the workaround with gdaldem worked fine for me. I can use the integer output
for nice looking visualisation in the background and the floating ERDAS Img
for further processing.
Are there any plans to be able to translate GRASS color tables of a floating
point band into a matching GDAL object? Would it make sense to write an
enhancement report to the GDAL bug tracker?
More information about the gdal-dev