[GRASS-dev] r.out.gdal Gtiff output does not preserve color tables

Helena Mitasova hmitaso at unity.ncsu.edu
Wed Feb 27 19:50:44 EST 2008


I can confirm this also with the new data set and ArcGIS. It looks like
r.out.gdal does not "see" the correct region and when the region is set
to the raster it adds one no-data row (or column - I don't remember now)
which is some huge negative number and that may be screwing up
the colors. I think that when my region was set smaller than the raster
the subset of data was OK - but I would have to check.
For convenience, it would be useful to add a flag to r.out.gdal to
export the entire raster map not just a subset given by the region.

Helena


On Feb 27, 2008, at 1:09 PM, Patton, Eric wrote:

> 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.
> _______________________________________________
> grass-dev mailing list
> grass-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/grass-dev



More information about the grass-dev mailing list