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 licensingDeployment licensing
ArcGIS for Desktop AdvancedArcGIS for Desktop Advanced
ArcGIS for Desktop StandardArcGIS for Desktop Standard
ArcGIS for Desktop BasicArcGIS for Desktop Basic
Engine Developer KitEngine