[Gdal-dev] Extracting and Setting the Entire Header of a .img ( HFA) File

Frank Warmerdam warmerdam at pobox.com
Fri Feb 21 16:54:31 EST 2003

Anand Madhavan wrote:
> Hi,
>    I am writing an application using the APIs of gdal. What I need to do is
> basically, extract the entire Header information of a .img file, (HFA),
> which includes all the information including, the Geo-Referencing,
> Projection, MaxValue, MinValue, etc. Also, I need to set all these
> information into another .img file which I create separately.
>    Is there a function like GetImgHeaderInfo() and SetImgHeaderInfo() which
> will help me out ?
> Kindly let me know.


Sorry, no there is not.  You could write such a program using the lower
level HFA API used by GDAL.  If you dig around in gdal/frmts/hfa you
can see how it is used in hfadataset.cpp (the GDAL binding on top of the
HFA API), and try to implement such a thing yourself, but it wouldn't
be a trivial undertaking.

If you just have a few items you want transported we could likely improve
the GDAL driver to preserve the info via metadata.  Note that a rough (but
lossy) form of the projection is maintained, and georeferencing should match
already using GDAL.

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