[Gdal-dev] r.out.gdal vs gdal_translate vs gdalwarp
Maciej Sieczka
tutey at o2.pl
Wed May 9 15:35:34 EDT 2007
Hi
I have noticed that analogous options settings in r.out.gdal,
gdal_translate and gdalwarp result in GeoTIFF's of significantly
different sizes. Sorry for crossposting, but I have no idea if it is
and issue in GDAL or GRASS.
Take the following example, based on GRASS spearfish60 location, raster
elevation.dted:
$ r.out.gdal in=elevation.dted format=GTiff type=Byte out=grass_copy.tif
grass_copy.tif = 36965 bytes
$ gdal_translate grass_copy.tif grass_trans_copy.tif
grass_trans_copy.tif = 29153 bytes
$ gdalwarp grass_copy.tif grass_warp_copy.tif
grass_warp_copy.tif = 36336 bytes
Each command does only a raw copy of input. Sizes of the r.out.gdal and
gdalwarp outputs are similar, but the gdal_translate output is 1/6
smaller. Is that normal?
Another example, with LZW compression:
$ r.out.gdal in=elevation.dted format=GTiff type=Byte out=grass_lzw.tif
createopt=COMPRESS=LZW
grass_lzw.tif = 23497 bytes
$ gdal_translate -co "COMPRESS=LZW" grass_copy.tif grass_trans_lzw.tif
grass_trans_lzw.tif = 21601 bytes
$ gdalwarp -co "COMPRESS=LZW" grass_copy.tif grass_warp_lzw.tif
grass_warp_lzw.tif = 22868 bytes
Differences between the 3 tiffs here are not huge, yet still
significant. Is that OK? I thought each should be more less the same.
The only difference in the gdalinfo output of each of the 3 tiffs in
either the first or second example is 7 lines of metadata, which are
present in r.out.gdal and gdal_translate output while missing in
gdalwarp output. However, it is only 397 bytes, which is not enough to
explain kilobytes of differences.
Maciek
More information about the Gdal-dev
mailing list