[gdal-dev] gdal_merge and HFA band statistics
Frank Warmerdam
warmerdam at pobox.com
Fri Nov 19 14:23:52 EST 2010
Matt Hanneman wrote:
> Can anyone tell me why the option 'STATISTICS=YES' works when using
> gdal_translate to translate from TIF to HFA (Erdas Imagine), but will
> NOT work when using gdal_merge to stack multiple TIFs into HFA? I need
> ArcMap to read the statistics, but it doesnt seem that they are being
> written to the file. I find this strange because ArcMap can identify the
> Stats when an HFA image is created with gdal_translate.
Matt,
gdal_translate uses the HFA driver's "CreateCopy" method which
honours the STATISTICS=YES creation option. gdal_merge uses
the HFA driver's Create method and then imperatively writes
chunks into the file here and there. The general write support
does not honour the statistics option.
Ideally the end user would not need to be too aware of the
two creation strategies but in practice it is significant
in a number of situations including yours, and the daily
questions about why folks can't use gdal_merge.py to produce
format XXX.
If you need the statistics you will just have to produce a mosaic
and then translate it again to produce a final file with the
statistics. If the issue is very important to you it might be
possible to modify things so that the statistics generated by
gdalinfo -stats can be written back into the original HFA file
in an ArcMap compatible form - but that could be pretty involved.
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 | Geospatial Programmer for Rent
More information about the gdal-dev
mailing list