How to open a file geodatabase raster catalog


This sample shows how to open a raster Catalog in a File geodatabase.

How to use

  1. Add this function to your project.
  2. Call this function from your code.
[VBA]
Public Function OpenFGDBRasterCatalog(sPath As String, sRasterCatalogName As String) As IRasterCatalog
    
    ' Open File geodatabase raster dataset with the given name
    ' sPath is the FGDB path
    ' sRasterCatalogName is the name of the raster catalog
    
    Dim pWsFact As IWorkspaceFactory2
    Dim pWs As IRasterWorkspaceEx
    Dim pRasterCatalog As IRasterCatalog
    
    'Open the file geodatabase workspace
    Set pWsFact = New FileGDBWorkspaceFactory
    Set pWs = pWsFact.OpenFromFile(sPath, 0)
    
    'Open the FGDB raster Catalog
    Set pRasterCatalog = pWs.OpenRasterCatalog(sRasterCatalogName)
    
    'Return
    Set OpenFGDBRasterCatalog = pRasterCatalog
    
    Set pWsFact = Nothing
    Set pWs = Nothing
    Set pRasterCatalog = Nothing
    
End Function