Opening a Mosaic dataset
Do the following steps to open a Mosaic dataset from a file geodatabase:
- Create a geodatabase workspace.
- Create the mosaic workspace extension helper class.
- Locate the applicable extension from the workspace.
- Use the extension to open the mosaic dataset.
See the following code example:
// Create a gdb workspace.
IWorkspaceFactory workspaceFactory = new FileGDBWorkspaceFactoryClass();
IWorkspace fgdbWorkspace = workspaceFactory.OpenFromFile(@"C:\testGdb.gdb", 0);
// Create the mosaic workspace extension helper class.
IMosaicWorkspaceExtensionHelper mosaicExtHelper = new
MosaicWorkspaceExtensionHelperClass();
// Find the right extension from the workspace.
IMosaicWorkspaceExtension mosaicExt = mosaicExtHelper.FindExtension(fgdbWorkspace);
// Use the extension to open the mosaic dataset.
IMosaicDataset theMosaicDataset = mosaicExt.OpenMosaicDataset("testMD");
[VB.NET]
' Create a gdb workspace.
Dim workspaceFactory As IWorkspaceFactory = Nothing
workspaceFactory = New FileGDBWorkspaceFactory()
Dim fgdbWorkspace As IWorkspace = Nothing
fgdbWorkspace = workspaceFactory.OpenFromFile("C:\testGdb.gdb", 0)
' Create the mosaic workspace extension helper class.
Dim mosaicExtHelper As IMosaicWorkspaceExtensionHelper = Nothing
mosaicExtHelper = New MosaicWorkspaceExtensionHelperClass()
' Find the right extension from the workspace.
Dim mosaicExt As IMosaicWorkspaceExtension = Nothing
mosaicExt = mosaicExtHelper.FindExtension(fgdbWorkspace)
' Use the extension to open the mosaic dataset.
Dim theMosaicDataset As IMosaicDataset = Nothing
theMosaicDataset = mosaicExt.OpenMosaicDataset("testMD")
To use the code in this topic, reference the following assemblies in your Visual Studio project. In the code files, you will need using (C#) or Imports (VB .NET) directives for the corresponding namespaces (given in parenthesis below if different from the assembly name):
ESRI.ArcGIS.DataSourcesRaster ESRI.ArcGIS.DataSourcesGDB ESRI.ArcGIS.Geodatabase ESRI.ArcGIS.System (ESRI.ArcGIS.esriSystem)
Development licensing | Deployment licensing |
---|---|
ArcEditor | ArcEditor |
ArcInfo | ArcInfo |