[Gdal-dev] r.out.gdal vs gdal_translate vs gdalwarp

Frank Warmerdam warmerdam at pobox.com
Mon May 14 07:56:56 EDT 2007


Maciej Sieczka wrote:
  > Try the following on the sample:
> 
> $ gdal_translate vegcover3.tif vegcover3_gt.tif
> 
> vegcover3_gt.tif size is 28628 bytes. Identical to input. OK.
> 
> $ gdalwarp vegcover3.tif vegcover3_gw.tif
> 
> vegcover3_gw.tif size is 36336 bytes. That's 27% bigger than the input!
> 
> But why? I can't see a reason there should be any difference. gdalwarp
> is supposed to do a raw copy of the input if no switches present; or
> isn't it? Maybe I'm just missing something.

Maciek,

gdalwarp uses very different library interfaces and io strategies from
gdal_translate.  So in some circumstances the output may differ.

On careful review, the difference in the file in question is because
gdal_translate uses the TIFFWriteScanline() interface to write the output
file from within GTiffDataset::CreateCopy(), and this only writes as much
of the final 'strip' of the file as is required to complete image area.
But gdalwarp goes through the blockio interface which writes the complete
final strip, even the portion that falls off the end of the file.

Best regards,
-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | President OSGeo, http://osgeo.org




More information about the Gdal-dev mailing list