How to add hdf files to map file?

Frank Warmerdam warmerdam at POBOX.COM
Wed Nov 10 10:16:26 EST 2004


wlx wrote:
> Hi,
>     Gdal  has included hdf4 file format's support from version 1.2.3,and I
> has installed it in my debian system.But I don't know how to add hdf's
> subdataset to map file as a layer,so can someone help me?

LiangXu Wang,

If you run gdalinfo on a complex HDF file you will see a list of subdatasets.

Stuff like:

Subdatasets:
   SUBDATASET_1_NAME=HDF4_EOS:EOS_SWATH:"/u/data/hdf/MOD07_L2.A2000110.0220.002.2
000196104217.hdf":mod07:Scan_Start_Time
   SUBDATASET_1_DESC=[406x270] Scan_Start_Time (64-bit floating-point)
   SUBDATASET_2_NAME=HDF4_EOS:EOS_SWATH:"/u/data/hdf/MOD07_L2.A2000110.0220.002.2
000196104217.hdf":mod07:Solar_Zenith
   SUBDATASET_2_DESC=[406x270] Solar_Zenith (16-bit integer)
   SUBDATASET_3_NAME=HDF4_EOS:EOS_SWATH:"/u/data/hdf/MOD07_L2.A2000110.0220.002.2
000196104217.hdf":mod07:Solar_Azimuth
   SUBDATASET_3_DESC=[406x270] Solar_Azimuth (16-bit integer)
   SUBDATASET_4_NAME=HDF4_EOS:EOS_SWATH:"/u/data/hdf/MOD07_L2.A2000110.0220.002.2
000196104217.hdf":mod07:Sensor_Zenith
   SUBDATASET_4_DESC=[406x270] Sensor_Zenith (16-bit integer)
   SUBDATASET_5_NAME=HDF4_EOS:EOS_SWATH:"/u/data/hdf/MOD07_L2.A2000110.0220.002.2
000196104217.hdf":mod07:Sensor_Azimuth
   SUBDATASET_5_DESC=[406x270] Sensor_Azimuth (16-bit integer)
   SUBDATASET_6_NAME=HDF4_EOS:EOS_SWATH:"/u/data/hdf/MOD07_L2.A2000110.0220.002.2
000196104217.hdf":mod07:Brightness_Temperature



Take the SUBDATASET_n_NAME you want, and use that in your DATA statement in
your mapfile.  Make sure you use single quotes around it since the name itself
includes double quotes.

eg.

   DATA 'HDF4_EOS:EOS_SWATH:"/u/data/hdf/MOD07_L2.A2000110.0220.002.2000196104217.hdf":mod07:Brightness_Temperature'

Also, make sure you use absolute paths since the SHAPEPATH and other MapServer
path manipulation won't work properly in these dataset names since they are
not just the name of a simple filesystem object.

I hope this helps.

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 mapserver-users mailing list