How to access raster datasets in a raster catalog


This sample shows how to loop through a raster Catalog and get all valid raster datasets.

How to use

  1. Call this function from VBA.
[VBA]
Public Sub AccessRasterDatasetsInARasterCatalog(pCatalog As IRasterCatalog)
    
    ' loop through all the member raster datasets in the raster catalog
    
    
    Dim pFeatureClass As IFeatureClass
    Set pFeatureClass = pCatalog
    Dim featCnt As Long, i As Long
    Dim pFeature As IRasterCatalogItem
    Dim pDs As IRasterDataset
    
    Set pFeatureClass = pCatalog
    featCnt = pFeatureClass.FeatureCount(Nothing)
    On Error Resume Next
    For i = 1 To featCnt
        Set pFeature = pFeatureClass.GetFeature(i)
        If Not pFeature Is Nothing Then
            Set pDs = pFeature.RasterDataset
            MsgBox pDs.CompleteName
        End If
    Next i
    
End Sub