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):
- ESRI.ArcGIS.System (ESRI.ArcGIS.esriSystem)
- ESRI.ArcGIS.Geodatabase
- ESRI.ArcGIS.DataSourcesRaster
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 |