[GRASS-dev] r.out.gdal Gtiff output does not preserve color tables
Patton, Eric
epatton at nrcan.gc.ca
Wed Feb 27 13:09:24 EST 2008
I'm using today's Grass 6.3.svn source, gdal 1.5.0.
$ gdalinfo --formats | grep "GRASS"
GRASS (ro): GRASS Database Rasters (5.7+)
In Spearfish60:
$ r.info -t elevation.10m
datatype=DCELL
$ g.region rast=elevation.10m -p
projection: 1 (UTM)
zone: 13
datum: nad27
ellipsoid: clark66
north: 4928000
south: 4914020
west: 590010
east: 609000
nsres: 10
ewres: 10
rows: 1398
cols: 1899
cells: 2654802
The following commands all produce tiffs that display completely black in off-the-shelf
image viewers in Ubuntu 7.10: (Eye of Gnome 2.20.1, GIMP 2.4.4)
$ r.out.gdal input=elevation.10m output=elevation.10m.tif type=Byte
$ r.out.gdal input=elevation.10m output=elevation.10m.tif type=Byte createopt="INTERLEAVE=PIXEL"
$ r.out.gdal input=elevation.10m output=elevation.10m.tif type=Byte createopt="INTERLEAVE=PIXEL,PROFILE=GeoTIFF"
$ r.out.gdal input=elevation.10m output=elevation.10m.tif type=Byte createopt="INTERLEAVE=PIXEL,PROFILE=BASELINE"
These commands give a completely blank raster in the same image viewers:
$ r.out.gdal input=elevation.10m output=elevation.10m.tif type=UInt16
$ r.out.gdal input=elevation.10m output=elevation.10m.tif type=UInt16 createopt="INTERLEAVE=PIXEL"
$ r.out.gdal input=elevation.10m output=elevation.10m.tif type=UInt16 createopt="INTERLEAVE=PIXEL,PROFILE=GeoTIFF"
$ r.out.gdal input=elevation.10m output=elevation.10m.tif type=UInt16 createopt="INTERLEAVE=PIXEL,PROFILE=BASELINE"
According to r.out.gdal manual, the type= parameter should be set to either Byte or UInt16
to preserve the color table. I can't get either type to output anything useful. Using any other
type causes r.out.gdal to complain that the color tables won't be preserved. What am I missing here?
Even the example from the r.out.gdal manual page produces an error and a tiff that does not display anything:
$ r.out.gdal in=elevation.10m out=ned_elev10m.tif type=Float64 createopt="INTERLEAVE=PIXEL,TFW=YES"
Exporting to GDAL data type: Float64
ERROR 6: SetColorTable() only supported for Byte or UInt16 bands in TIFF format.
100%
r.out.gdal complete.
Is a tiff without a color table even useful? I'd settle for a lossy, interpolated color table.
Normally I would just use r.out.tiff as a workaround, but I think this module ought to output
georeferenced tiffs with sane color tables. In any case, I can't use the tiff-with-worldfile
workaround; I need geotiffs with the projection info written into the header - *with* a color table.
~ Eric.
More information about the grass-dev
mailing list