This document is archived and information here might be outdated.  Recommended version.


How to open a Mosaic dataset (ArcObjects .NET 10.4 SDK)

How to open a Mosaic dataset


Opening a Mosaic dataset

Do the following steps to open a Mosaic dataset from a file geodatabase:
  1. Create a geodatabase workspace.
  2. Create the mosaic workspace extension helper class.
  3. Locate the applicable extension from the workspace.
  4. Use the extension to open the mosaic dataset.

    See the following code example:
[C#]
// 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):
Development licensing Deployment licensing
ArcGIS for Desktop Standard ArcGIS for Desktop Standard
ArcGIS for Desktop Advanced ArcGIS for Desktop Advanced