How to access HDF subdatasets


Summary
Some raster formats can contain multiple subdatasets inside a single file; for example, the Hierarchical Data Format (HDF). The code example in this article shows how you can retrieve the HDF subdatasets using the IRasterDatasetJukebox interface.

Accessing HDF subdatasets

[Java]
static IRasterDataset HDFSubdataset(IRasterDataset rasterDataset, int subsetID)
    throws Exception{
    //RasterDataset represents a raster dataset from a HDF4 file.
    IRasterDatasetJukebox hdfDataset = new IRasterDatasetJukeboxProxy(rasterDataset);
    IRasterDataset subDatasset;
    int datasetCount = hdfDataset.getSubdatasetCount();
    if (subsetID < datasetCount){
        hdfDataset.setSubdataset(subsetID);
        subDatasset = new IRasterDatasetProxy(hdfDataset);
        return subDatasset;
    }
    else{
        return rasterDataset;
    }
}






Development licensing Deployment licensing
ArcGIS for Desktop Advanced ArcGIS for Desktop Advanced
ArcGIS for Desktop Standard ArcGIS for Desktop Standard
ArcGIS for Desktop Basic ArcGIS for Desktop Basic
Engine Developer Kit Engine