[Gdal-dev] How to find the count of subdatasets of a HDF file?

Even Rouault even.rouault at mines-paris.org
Wed Aug 5 14:40:16 EDT 2009


----- Original Message ----- 
From: kohain
To: gdal-dev at lists.osgeo.org
Sent: Wednesday, August 05, 2009 10:27 AM
Subject: [Gdal-dev] How to find the count of subdatasets of a HDF file?


>> How to find the count of subdatasets of a HDF file?

CSLCount(GDALGetMetadata(hDS, "SUBDATASETS")) / 2

The division by 2 is dueto each subdataset having 2 metadata items : 
SUBDATASET_xxx_NAME and SUBDATASET_xxx_DESC

See http://gdal.org/gdal_datamodel.html at "SUBDATASETS Domain" section

>> and how to ascertain band counts of each subdataset?

GDALOpen() each SUBDATASET_xxx_NAME  and call GDALGetRasterCount() on the 
result dataset handle.

_______________________________________________
gdal-dev mailing list
gdal-dev at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev 




More information about the gdal-dev mailing list