[Gdal-dev] HDF4 format read in - command line ?

Frank Warmerdam warmerdam at pobox.com
Tue May 8 10:17:15 EDT 2007


Hannes Isaak Reuter wrote:
> Today i got an HDF4 format dataset to help on and somehow I'm to stupid 
> to tell my colleagues to tell how to read it in..
> Usually I was reading it using the gdalinfo,
> identifying the
> SUBDATASET_1_NAME
> 
> and than use that for the gdalwarp process..
> 
> with that HDF file now i have no idea how to call the substring. and 
> after playing around for 3 hours with different combinations i deccide 
> to call for help..
> If anybody can tell me the file/band string from the gdalinfo command 
> given below, i'm quite happy ..
> 
> U:\share\Luis>gdalinfo GEO2004001.hdf
> Driver: HDF4Image/HDF4 Dataset
> Size is 11277, 3086
> Coordinate System is:
> GEOGCS["Unknown datum based upon the Clarke 1866 ellipsoid",
>     DATUM["Not specified (based on Clarke 1866 spheroid)",
>         SPHEROID["Clarke 1866",6378206.4,294.9786982139006,
>             AUTHORITY["EPSG","7008"]]],
>     PRIMEM["Greenwich",0],
>     UNIT["degree",0.0174532925199433]]
> Origin = (-29.238043888889045,70.000000000000000)
> Pixel Size = (0.012964385918241,-0.012964386026500)
> Metadata:
...
> Corner Coordinates:
> Upper Left  ( -29.2380439,  70.0000000) ( 29d14'16.96"W, 70d 0'0.00"N)
> Lower Left  ( -29.2380439,  29.9919047) ( 29d14'16.96"W, 29d59'30.86"N)
> Upper Right ( 116.9613361,  70.0000000) (116d57'40.81"E, 70d 0'0.00"N)
> Lower Right ( 116.9613361,  29.9919047) (116d57'40.81"E, 29d59'30.86"N)
> Center      (  43.8616461,  49.9959524) ( 43d51'41.93"E, 49d59'45.43"N)
> Band 1 Block=11277x1 Type=Int16, ColorInterp=Gray

Hannes,

It seems that this file can be used directly without fooling with
subdatasets.  I think this is a special case in the code for HDF4
files with only one subdataset.  Accessing the main file is treated
as equivelent to accessing that subdatset.  So you can just do stuff like:

   gdalwarp GEO2004001.hdf out.tif

I see the file is 11277x3086 with 1 16bit band and a nice regular sampling
in geographic coordinates.

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