How to open a personal geodatabase raster catalog


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

How to use

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