How to open an ArcSDE raster catalog


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

How to use

  1. Paste the function into your project.
  2. Call the function from your code.
[VBA]
Public Function OpenArcSDERasterCatalog(sServer As String, _
                                        sInstance As String, _
                                        sDatabase As String, _
                                        sUser As String, _
                                        sPassword As String, _
                                        sRasterCatalogName As String, _
                                        Optional sVersion As String = "sde.DEFAULT") As IRasterCatalog
    
    
    ' Open an ArcSDE raster Catalog with the given name
    ' sServer, sInstance, sDatabase, sUser, sPassword, sVersion are database connection info
    ' sRasterCatalogName is the name of the raster Catalog
    
    'sFile is the filename
    
    Dim pWsFact As IWorkspaceFactory
    Dim pWs As IRasterWorkspaceEx
    Dim pRasterCatalog As IRasterCatalog
    Dim pPropertySet As IPropertySet
    
    
    'Open the ArcSDE workspace
    Set pPropertySet = New PropertySet
    With pPropertySet
        .SetProperty "server", sServer
        .SetProperty "instance", sInstance
        .SetProperty "database", sDatabase
        .SetProperty "user", sUser
        .SetProperty "password", sPassword
        .SetProperty "version", sVersion
    End With
    Set pWsFact = New SdeWorkspaceFactory
    Set pWs = pWsFact.Open(pPropertySet, 0)
    
    
    'Open the ArcSDE raster Catalog
    Set pRasterCatalog = pWs.OpenRasterCatalog(sRasterCatalogName)
    
    
    'Return
    Set OpenArcSDERasterCatalog = pRasterCatalog
    
    Set pWsFact = Nothing
    Set pWs = Nothing
    Set pRasterCatalog = Nothing
    
End Function