[Gdal-dev] HDF MODIS conversion to GeoTiff WGS-84 referenced format

guillaume huby guillaume.huby.lists at gmail.com
Fri Apr 13 09:06:32 EDT 2007


mattia a écrit :
> Hey all, I really have great confusion on how to convert my HDF 4 images
> which reside as multiple bands into a single HDF file to a GeoTiff
> geo-referenced image. In reality, I need to convert the format into a
> single latitude/longitude *WGS-84* referenced TIFF image..I need to do
> this and at the same time obtain a .tfw file which specifies the top
> left corner coordinates of the image's bounding box and the pixel
> resolution of the image.
>
> I've tried to run the gdalinfo command on one of my images.. The image
> name is AMOD021KM20061229043102.hdf and when I run the command (under
> Ubuntu) I get the following stack report (the subdatasets are at the
> bottom part):
>
> //----------------------------------------------------------
> ---------------------START-LOG--------------
> --------------------------------------------------------
> -----------------------------
>
> rasdaman at mattia-desktop:~/FTPCHINA$ gdalinfo AMOD021KM20061229043102.hdf
> Driver: HDF4/Hierarchical Data Format Release 4
> Subdatasets:
>   SUBDATASET_1_NAME=HDF4_SDS:UNKNOWN:"AMOD021KM20061229043102.hdf":0
>   SUBDATASET_1_DESC=[15x3630x1354] EV_1KM_RefSB (16-bit unsigned integer)
>   SUBDATASET_2_NAME=HDF4_SDS:UNKNOWN:"AMOD021KM20061229043102.hdf":1
>   SUBDATASET_2_DESC=[15x3630x1354] EV_1KM_RefSB_Uncert_Indexes (8-bit
> unsigned integer)
>   SUBDATASET_3_NAME=HDF4_SDS:UNKNOWN:"AMOD021KM20061229043102.hdf ":2
>   SUBDATASET_3_DESC=[2x3630x1354] EV_250_Aggr1km_RefSB (16-bit unsigned
> integer)
>   SUBDATASET_4_NAME=HDF4_SDS:UNKNOWN:"AMOD021KM20061229043102.hdf":3
>   SUBDATASET_4_DESC=[2x3630x1354] EV_250_Aggr1km_RefSB_Uncert_Indexes
> (8-bit unsigned integer)
>   SUBDATASET_5_NAME=HDF4_SDS:UNKNOWN:"AMOD021KM20061229043102.hdf":4
>   SUBDATASET_5_DESC=[2x3630x1354] EV_250_Aggr1km_RefSB_Samples_Used
> (8-bit unsigned integer)
>   SUBDATASET_6_NAME=HDF4_SDS:UNKNOWN:" AMOD021KM20061229043102.hdf":5
>   SUBDATASET_6_DESC=[5x3630x1354] EV_500_Aggr1km_RefSB (16-bit unsigned
> integer)
>   SUBDATASET_7_NAME=HDF4_SDS:UNKNOWN:"AMOD021KM20061229043102.hdf":6
>   SUBDATASET_7_DESC=[5x3630x1354] EV_500_Aggr1km_RefSB_Uncert_Indexes
> (8-bit unsigned integer)
>   SUBDATASET_8_NAME=HDF4_SDS:UNKNOWN:"AMOD021KM20061229043102.hdf":7
>   SUBDATASET_8_DESC=[5x3630x1354] EV_500_Aggr1km_RefSB_Samples_Used
> (8-bit unsigned integer)
>   SUBDATASET_9_NAME=HDF4_SDS:UNKNOWN:" AMOD021KM20061229043102.hdf":8
>   SUBDATASET_9_DESC=[16x3630x1354] EV_1KM_Emissive (16-bit unsigned
integer)
>   SUBDATASET_10_NAME=HDF4_SDS:UNKNOWN:"AMOD021KM20061229043102.hdf":9
>   SUBDATASET_10_DESC=[16x3630x1354] EV_1KM_Emissive_Uncert_Indexes
> (8-bit unsigned integer)
>   SUBDATASET_11_NAME=HDF4_SDS:UNKNOWN:"AMOD021KM20061229043102.hdf":10
>   SUBDATASET_11_DESC=[726x271] Latitude (32-bit floating-point)
>   SUBDATASET_12_NAME=HDF4_SDS:UNKNOWN:"AMOD021KM20061229043102.hdf ":11
>   SUBDATASET_12_DESC=[726x271] Longitude (32-bit floating-point)
>   SUBDATASET_13_NAME=HDF4_SDS:UNKNOWN:"AMOD021KM20061229043102.hdf":12
>   SUBDATASET_13_DESC=[726x271] Height (16-bit integer)
>   SUBDATASET_14_NAME=HDF4_SDS:UNKNOWN:"AMOD021KM20061229043102.hdf":13
>   SUBDATASET_14_DESC=[726x271] SensorZenith (16-bit integer)
>   SUBDATASET_15_NAME=HDF4_SDS:UNKNOWN:"AMOD021KM20061229043102.hdf":14
>   SUBDATASET_15_DESC=[726x271] SensorAzimuth (16-bit integer)
>   SUBDATASET_16_NAME=HDF4_SDS:UNKNOWN:"AMOD021KM20061229043102.hdf":15
>   SUBDATASET_16_DESC=[726x271] Range (16-bit unsigned integer)
>   SUBDATASET_17_NAME=HDF4_SDS:UNKNOWN:" AMOD021KM20061229043102.hdf":16
>   SUBDATASET_17_DESC=[726x271] SolarZenith (16-bit integer)
>   SUBDATASET_18_NAME=HDF4_SDS:UNKNOWN:"AMOD021KM20061229043102.hdf":17
>   SUBDATASET_18_DESC=[726x271] SolarAzimuth (16-bit integer)
>   SUBDATASET_19_NAME=HDF4_SDS:UNKNOWN:"AMOD021KM20061229043102.hdf":18
>   SUBDATASET_19_DESC=[726x271] gflags (8-bit unsigned integer)
>   SUBDATASET_20_NAME=HDF4_SDS:UNKNOWN:"AMOD021KM20061229043102.hdf ":19
>   SUBDATASET_20_DESC=[3630x1354] EV_Band26 (16-bit unsigned integer)
>   SUBDATASET_21_NAME=HDF4_SDS:UNKNOWN:"AMOD021KM20061229043102.hdf":20
>   SUBDATASET_21_DESC=[3630x1354] EV_Band26_Uncert_Indexes (8-bit
> unsigned integer)
>   SUBDATASET_22_NAME=HDF4_SDS:UNKNOWN:"AMOD021KM20061229043102.hdf":21
>   SUBDATASET_22_DESC=[16x10] Noise in Thermal Detectors (8-bit unsigned
> integer)
>   SUBDATASET_23_NAME=HDF4_SDS:UNKNOWN:"AMOD021KM20061229043102.hdf ":22
>   SUBDATASET_23_DESC=[16x10] Change in relative responses of thermal
> detectors (8-bit unsigned integer)
>   SUBDATASET_24_NAME=HDF4_SDS:UNKNOWN:"AMOD021KM20061229043102.hdf":23
>   SUBDATASET_24_DESC=[363x16x10] DC Restore Change for Thermal Bands
> (8-bit integer)
>   SUBDATASET_25_NAME=HDF4_SDS:UNKNOWN:"AMOD021KM20061229043102.hdf":24
>   SUBDATASET_25_DESC=[363x2x40] DC Restore Change for Reflective 250m
> Bands (8-bit integer)
>   SUBDATASET_26_NAME=HDF4_SDS:UNKNOWN:" AMOD021KM20061229043102.hdf":25
>   SUBDATASET_26_DESC=[363x5x20] DC Restore Change for Reflective 500m
> Bands (8-bit integer)
>   SUBDATASET_27_NAME=HDF4_SDS:UNKNOWN:"AMOD021KM20061229043102.hdf":26
>   SUBDATASET_27_DESC=[363x15x10] DC Restore Change for Reflective 1km
> Bands (8-bit integer)
> Corner Coordinates:
> Upper Left  (    0.0,    0.0)
> Lower Left  (    0.0,  512.0)
> Upper Right (  512.0,    0.0)
> Lower Right (  512.0,  512.0)
> Center      (  256.0,  256.0)
>
>
//--------------------------------------------------------------------------END-LOG

> --------------------------
> ----------------------------------------------------------
> -----------------------------
>
> It looks like the subdatasets could be malformed... This is because I
> get these SUBDATASET_X_NAME=HDF4_SDS:UNKNOWN: syntax.. is that right..
> I've been told that the images are MODIS images from Terra and Aqua
> satellites. I also read that MODIS is used for snow detection only.. is
> this correct??
>
> I'm trying to understand how to achieve what I need and so far I
> understand that the required commands are the gdal_transform or the
> gdalwarp commands.
>
> When I run gdal_translate on the file, I get the following:
>
> rasdaman at mattia-desktop :~/FTPCHINA$ gdal_translate
> AMOD021KM20061229043102.hdf test.tiff
> Input file contains subdatasets. Please, select one of them for reading.
> rasdaman at mattia-desktop:~/FTPCHINA$
>
> Hence my question is, how do I tell the command to pick up a certain
> dataset?? And, where can I find the relative documentation for this
> command when applied to multiple HDF bands??
>
> Finally, I reside in Germany and need to transform a whole lot of images
> into GeoTiff to later establish a WMS service .. Hence all conversion
> will need be done remotely... Does anyone have any suggestions on how I
> should go on about this?? Should I be using the gdal library or would I
> best bet on something else???
> Msphinx?? ENVI??
>
you should try :
$ gdal_translate HDF4_SDS:UNKNOWN:"AMOD021KM20061229043102.hdf":0
test_b0.tif
$ gdal_translate HDF4_SDS:UNKNOWN:"AMOD021KM20061229043102.hdf":1
test_b1.tif
... and so on for each dataset

same with gdalwarp.

this extract only one band. Then you can use gdal_merge or gdalwarp to merge
bands in a single raster.

Also have a look to some previous post in the list :
http://thread.gmane.org/gmane.comp.gis.gdal.devel/10482
if you meet trouble to get WGS84 correct.

Good alternates are MRT or HEG modis tools ...

Good luck !
Guillaume.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20070413/a4d29c6f/attachment.html


More information about the Gdal-dev mailing list