[GRASS-user] GRASS export GeoTiff adventure :-)

Nikos Alexandris nikos.alexandris at felis.uni-freiburg.de
Sat Aug 2 13:22:14 EDT 2008


Markus,
thank you for your precious time. See below some comments.

On Sat, 2008-08-02 at 15:53 +0200, Markus Metz wrote:
> Nikos Alexandris wrote:
> > 1. Using r.composite and exporting with r.out.gdal gives "white" as
> > nodata. Whenever I set "nodata=0" I don't get a viewable photo
> >   
> Weird, it might have something to do with exporting a composite, it 
> should work on single bands and groups.
> > 3. GeoTiff metadata are lost always (?) while exporting with
> > r.out.gdal. 
> >   
> Also when checking with gdalinfo?
No, I was talking about a known error [1]. How important is this error?


> > 4. The createopt="INTERLEAVE=PIXEL" is not respected by r.out.gdal (?)
> >   
> I would not change the default settings of gdal until I have good reason 
> to do so.

Well, the original photos are "INTERLEAVE=PIXEL" and I suppose, from
what I read, it's a requirement for "limited" viewers (!) [2][3].
Exporting single maps gives "INTERLEAVE=BAND"!

> > 6. Is it better to export the red, green and blue GRASS raster maps
> > one-by-one and merge them with gdal_translate (or gdal_merge.py)?
> >   
> If I want a RGB GeoTIFF, I rather export the group.

What about the error message "ERROR 6: SetColorTable() not supported for
multi-sample TIFF files." which appears 3 times for a group that
contains 3 maps (red, green and blue in our case)?


> > 7. Exporting a group (the ones that automatically are created for each
> > imported photo and contain the red, green and blue components
> > respectively), gives "INTERLEAVE=PIXEL" but "Block=2500x3". Is it
> > correct to force createopt="BLOCKYSIZE=1" which gives "Block=2500x1"? 
> >   
> BLOCKXSIZE and BLOCKYSIZE affect the tile size, as far as I understand 
> the gdal documentation. I would not change the defaults. Leaving 
> BLOCKXSIZE on default = 256 and setting BLOCKYSIZE to 1 should produce 
> tiles of size 256x1.

The original photos I have report (gdalinfo) for example:
Driver: GTiff/GeoTIFF
[...]
Size is 2500, 2500
[...]
Image Structure Metadata:
  INTERLEAVE=PIXEL
[...]
Band 1 Block=2500x1 Type=Byte, ColorInterp=Red
Band 2 Block=2500x1 Type=Byte, ColorInterp=Green
Band 3 Block=2500x1 Type=Byte, ColorInterp=Blue

Exporting a composite (created with r.composite) gives:
Driver: GTiff/GeoTIFF
[...]
Size is 2500, 2500
[...]
Pixel Size = (0.800000000000000,-0.800000000000000)
Metadata:
  AREA_OR_POINT=Area
Image Structure Metadata:
  INTERLEAVE=BAND
[...]
Band 1 Block=2500x3 Type=Byte, ColorInterp=Palette

Exporting a group gives "correctly" something like:
[...]
Band 1 Block=2500x1 Type=Byte, ColorInterp=Red
  Metadata:
    COLOR_TABLE_RULES_COUNT=1
    COLOR_TABLE_RULE_RGB_0=0.000000e+00 2.550000e+02 0 0 0 255 255 255
Band 2 Block=2500x1 Type=Byte, ColorInterp=Green
  Metadata:
    COLOR_TABLE_RULES_COUNT=1
    COLOR_TABLE_RULE_RGB_0=0.000000e+00 2.550000e+02 0 0 0 255 255 255
Band 3 Block=2500x1 Type=Byte, ColorInterp=Blue
  Metadata:
    COLOR_TABLE_RULES_COUNT=1
    COLOR_TABLE_RULE_RGB_0=0.000000e+00 2.550000e+02 0 0 0 255 255 255

> > 8. There are several compression methods? Does compression affect
> > significantly reading/displaying an image?
> >   
> I would stay away from tiff internal compression because other software 
> might not support it (LZW and DEFLATE are sometimes not supported). If I 
> want to distribute the tiff, I rather create an archive and send that.
Maciek suggested to compress the overviews to save disk space. Would
this cause a viewing problem in Arc? (Have no access to any commercial
package currently).

> > 9. Should one prefer another file format?
> >   
> GeoTIFF is widely accepted, but if I want to provide a raster for a 
> particular application, gdal might support the native raster format of 
> that application and then this would be the preferred format.

> TFW=YES would only be needed if you export a raster for an application 
> that can not read GeoTIFF internal metadata. In this case I would rather 
> use the native format of that application. Many spatial data viewer make 
> use of gdal and should therefore read GeoTIFF properly.
> 
> Maybe there is a problem with your gdal installation? I would first 
> check that simple single band export with default settings works before 
> trying to fix the gdal installation.
> 
> I hope that helps,
> 
> Markus

I will re-check.

[1] "Warning 1: Lost metadata writing to GeoTIFF ... too large to fit in
tag.": The color table metadata are too large. It is recommended to use
a different output format.

More in the manual of r.out.gdal:
http://grass.osgeo.org/grass64/manuals/html64_user/r.out.gdal.html

[2] http://www.gdal.org/frmt_gtiff.html under section "Creation Options"

[3]
http://gfoss.blogspot.com/2008/06/gdal-raster-data-tips-and-tricks.html
under section "Export to (limited) TIFF readers such as ArcView, or
ImageMagick"



More information about the grass-user mailing list