[gdal-dev] [GRASS-user] r.out.gdal export with color table for floating-point values

Even Rouault even.rouault at mines-paris.org
Mon Aug 1 10:24:23 EDT 2011


Selon Otto Dassau <dassau at gbd-consult.de>:

> 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?

Otto,

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,

Even

>
> thanks a lot
>   Otto
>
> Am Fri, 22 Jul 2011 09:18:53 +0200
> schrieb Otto Dassau <dassau at gbd-consult.de>:
>
> > 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
>
>
>
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev
>




More information about the gdal-dev mailing list