This sample shows how to open a raster Dataset in a File geodatabase.
How to use
- Paste this function in your code.
- Call this function from your code.
Public Function OpenFGDBRasterDataset(sPath As String, sRasterDatasetName As String) As IRasterDataset
' Open File geodatabase raster dataset with the given name
' sPath is the FGDB path
' sRasterDatasetName is the name of the raster Dataset
Dim pWsFact As IWorkspaceFactory2
Dim pWs As IRasterWorkspaceEx
Dim pRasterDataset As IRasterDataset
'Open the file geodatabase workspace
Set pWsFact = New FielGDBWorkspaceFactory
Set pWs = pWsFact.OpenFromFile(sPath, 0)
'Open the FGDB raster Dataset
Set pRasterDataset = pWs.OpenRasterDataset(sRasterDatasetName)
'Return
Set OpenFGDBRasterDataset = pRasterDataset
Set pWsFact = Nothing
Set pWs = Nothing
Set pRasterDataset = Nothing
End Function