How to create a table based raster catalog layer


This sample shows how to create a table based raster catalog layer.

How to use

  1. Add this function to your project.
  2. Call this function from your code.
[VBA]
Public Function CreateTableBasedRasterCatalogLayer(pFeatureWs As IFeatureWorkspace, sName As String) As IRasterCatalogLayer
    'pFeatureWs is the workspace where the table based raster catalog resides.
    'sName is the name of the raster catalog
    
    On Error GoTo erh
    
    'Open the raster catalog as a regular table
    Dim pTable As ITable
    Set pTable = pFeatureWs.OpenTable(sName)
    
    'Create raster catalog table
    Dim pCatalogTable As IRasterCatalogTable
    Set pCatalogTable = New RasterCatalogTable
    Set pCatalogTable.Table = pTable
    pCatalogTable.Update
    
    'Create raster catalog layer
    Dim pRasterCatalogLy As IRasterCatalogLayer
    Set pRasterCatalogLy = New RasterCatalogLayer
    pRasterCatalogLy.Create pCatalogTable
    
    Set CreateTableBasedRasterCatalogLayer = pRasterCatalogLy
erh:
    Set CreateTableBasedRasterCatalogLayer = Nothing
End Function