This document is archived and information here might be outdated.  Recommended version.


Accessing HDF and NITF subdatasets (ArcObjects .NET 10.5 SDK)

Accessing HDF and NITF subdatasets


About accessing HDF and NITF subdatasets

Some raster formats, such as the hierarchical data format (HDF), can contain multiple subdatasets in a single file. To access HDF subdatasets using the IRasterDatasetJukebox interface, see the following code example:
[C#]
public IRasterDataset HDFSubdataset(IRasterDataset rasterDataset, int subsetID)
{
    //RasterDataset represents a raster dataset from an HDF4 file.
    IRasterDatasetJukebox hdfDataset=(IRasterDatasetJukebox)rasterDataset;
    IRasterDataset subDataset;
    int datasetCount=hdfDataset.SubdatasetCount;
    if (subsetID < datasetCount)
    {
        hdfDataset.Subdataset=subsetID;
        subDataset=(IRasterDataset)hdfDataset;
        return subDataset;
    }
    else
    {
        return rasterDataset;
    }
}
[VB.NET]
Public Function HDFSubdataset(ByVal rasterDataset As IRasterDataset, ByVal subsetID As Integer) As IRasterDataset
    'RasterDataset represents a raster dataset from an HDF4 file.
    Dim hdfDataset As IRasterDatasetJukebox=CType(rasterDataset, IRasterDatasetJukebox)
    Dim subDataset As IRasterDataset
    Dim datasetCount As Integer=hdfDataset.SubdatasetCount
    If subsetID < datasetCount Then
        hdfDataset.Subdataset=subsetID
        subDataset=CType(hdfDataset, IRasterDataset)
        Return subDataset
    Else
        Return rasterDataset
    End If
End Function






To use the code in this topic, reference the following assemblies in your Visual Studio project. In the code files, you will need using (C#) or Imports (VB .NET) directives for the corresponding namespaces (given in parenthesis below if different from the assembly name):
Development licensing Deployment licensing
ArcGIS Desktop Advanced ArcGIS Desktop Advanced
ArcGIS Desktop Standard ArcGIS Desktop Standard
ArcGIS Desktop Basic ArcGIS Desktop Basic
Engine Developer Kit Engine