In this topic
- Creating a referenced mosaic dataset from a raster catalog
- Creating a referenced mosaic dataset from a Military Analyst raster catalog
- Creating a referenced mosaic dataset from an existing mosaic dataset
Creating a referenced mosaic dataset from a raster catalog
To create a referenced mosaic dataset from a raster catalog, follow these steps:
-
Create a MosaicWorkspaceExtension object.
-
Use the IMosaicWorkspaceExtension.CreateReferencedMosaicDataset method to create the referenced mosaic dataset.
-
Use MaximumVisibleCellsize for the mosaic parameter.
See the following code example:
[C#] static void CreateReferencedMosaic(IWorkspace ws, String MosaicDatasetName,
ISpatialReference SR, IRasterCatalog catalog)
{
//Use the IMosaicWorkspaceExtensionHelper class to obtain a MosaicWorkspaceExtension
//class from a workspace (ws).
IMosaicWorkspaceExtensionHelper MosaicWsHelper=new
MosaicWorkspaceExtensionHelperClass();
IMosaicWorkspaceExtension mosaicWsExtension=MosaicWsHelper.FindExtension(ws);
//Define the parameters for creating a referenced mosaic dataset.
ICreateMosaicDatasetParameters mdParameters=new
CreateMosaicDatasetParametersClass();
mdParameters.BandCount=3; //Optional.
mdParameters.PixelType=rstPixelType.PT_UCHAR; //Optional.
//If the raster catalog is a regular raster catalog, define this parameter.
mdParameters.MaximumVisibleCellsize=10;
//This is the threshold above which a rasterized wireframe will be displayed.
//Create the referenced mosaic dataset.
//Name represents the name of the mosaic dataset, SR represents the spatial reference,
//and catalog can be the input raster catalog or mosaic dataset.
IMosaicDataset md=mosaicWsExtension.CreateReferencedMosaicDataset
(MosaicDatasetName, SR, catalog, null, mdParameters);
}
[VB.NET] Public Sub CreateReferencedMoaic(ByVal ws As IWorkspace, ByVal MosaicDatasetName As String, ByVal catalog As IRasterCatalog, ByVal SR As ISpatialReference)
'Use the IMosaicWorkspaceExtensionHelper class to obtain a MosaicWorkspaceExtension class
'from a workspace (ws).
Dim MosaicWsHelper As IMosaicWorkspaceExtensionHelper
MosaicWsHelper=New MosaicWorkspaceExtensionHelperClass()
Dim mosaicWsExtension As IMosaicWorkspaceExtension
mosaicWsExtension=MosaicWsHelper.FindExtension(ws)
'Define the parameters for creating a referenced mosaic dataset.
Dim mdParameters As ICreateMosaicDatasetParameters
mdParameters=New CreateMosaicDatasetParametersClass()
mdParameters.BandCount=3 'Optional.
mdParameters.PixelType=rstPixelType.PT_UCHAR 'Optional.
'If the raster catalog is a regular raster catalog, define this parameter.
mdParameters.MaximumVisibleCellsize=10
'This is the threshold above which a rasterized wireframe will be displayed.
'Create the referenced mosaic dataset.
'Name represents the name of the mosaic dataset, SR represents the spatial reference,
'and catalog can be the input raster catalog or mosaic dataset.
Dim md As IMosaicDataset=mosaicWsExtension.CreateReferencedMosaicDataset(MosaicDatasetName, SR, catalog, Nothing, mdParameters)
End Sub
Creating a referenced mosaic dataset from a Military Analyst raster catalog
To create a referenced mosaic dataset from a Military Analyst raster catalog, follow these steps:
-
Create a MosaicWorkspaceExtension object.
-
Use the IMosaicWorkspaceExtension.CreateReferencedMosaicDataset method to create the referenced mosaic dataset.
-
Use LODFieldName for the mosaic parameter.
See the following code example, which defines the visibility using the Scale field in the raster catalog:
[C#] static void CreateReferencedMosaic(IWorkspace ws, String MosaicDatasetName,
ISpatialReference SR, IRasterCatalog catalog)
{
//Use the IMosaicWorkspaceExtensionHelper class to obtain a MosaicWorkspaceExtension
//class from a workspace (ws).
IMosaicWorkspaceExtensionHelper MosaicWsHelper=new
MosaicWorkspaceExtensionHelperClass();
IMosaicWorkspaceExtension mosaicWsExtension=MosaicWsHelper.FindExtension(ws);
//Define the parameters for creating a referenced mosaic dataset.
ICreateMosaicDatasetParameters mdParameters=new
CreateMosaicDatasetParametersClass();
mdParameters.BandCount=3; //Optional.
mdParameters.PixelType=rstPixelType.PT_UCHAR; //Optional.
//If the raster catalog is a regular raster catalog, define this parameter.
mdParameters.LODFieldName="Scale";
//This is the threshold above which a rasterized wireframe will be displayed.
//Create the referenced mosaic dataset.
//Name represents the name of the mosaic dataset, SR represents the spatial reference,
//and catalog can be the input raster catalog or mosaic dataset.
IMosaicDataset md=mosaicWsExtension.CreateReferencedMosaicDataset
(MosaicDatasetName, SR, catalog, null, mdParameters);
}
[VB.NET] Public Sub CreateReferencedMoaic(ByVal ws As IWorkspace, ByVal MosaicDatasetName As String, ByVal catalog As IRasterCatalog, ByVal SR As ISpatialReference)
'Use the IMosaicWorkspaceExtensionHelper class to obtain a MosaicWorkspaceExtension class
'from a workspace (ws).
Dim MosaicWsHelper As IMosaicWorkspaceExtensionHelper
MosaicWsHelper=New MosaicWorkspaceExtensionHelperClass()
Dim mosaicWsExtension As IMosaicWorkspaceExtension
mosaicWsExtension=MosaicWsHelper.FindExtension(ws)
'Define the parameters for creating a referenced mosaic dataset.
Dim mdParameters As ICreateMosaicDatasetParameters
mdParameters=New CreateMosaicDatasetParametersClass()
mdParameters.BandCount=3 'Optional.
mdParameters.PixelType=rstPixelType.PT_UCHAR 'Optional.
'If the raster catalog is a regular raster catalog, define this parameter.
mdParameters.LODFieldName="Scale"
'Create the referenced mosaic dataset.
'Name represents the name of the mosaic dataset, SR represents the spatial reference,
'and catalog can be the input raster catalog or mosaic dataset.
Dim md As IMosaicDataset=mosaicWsExtension.CreateReferencedMosaicDataset(MosaicDatasetName, SR, catalog, Nothing, mdParameters)
End Sub
Creating a referenced mosaic dataset from an existing mosaic dataset
To create a referenced mosaic dataset from an existing mosaic dataset, follow these steps:
-
Create a MosaicWorkspaceExtension object.
-
Use the IMosaicWorkspaceExtension.CreateReferencedMosaicDataset method to create the referenced mosaic dataset.
-
Use MinCellsizeFieldName and MaxCellsizeFieldName for the mosaic parameter.
See the following code example, which defines the visibility parameters from the MinPS and MaxPS fields:
[C#] static void CreateReferencedMosaic(IWorkspace ws, String MosaicDatasetName,
ISpatialReference SR, IRasterCatalog catalog)
{
//Use the IMosaicWorkspaceExtensionHelper class to obtain a MosaicWorkspaceExtension
//class from a workspace (ws).
IMosaicWorkspaceExtensionHelper MosaicWsHelper=new
MosaicWorkspaceExtensionHelperClass();
IMosaicWorkspaceExtension mosaicWsExtension=MosaicWsHelper.FindExtension(ws);
//Define the parameters for creating a referenced mosaic dataset.
ICreateMosaicDatasetParameters mdParameters=new
CreateMosaicDatasetParametersClass();
mdParameters.BandCount=3; //Optional.
mdParameters.PixelType=rstPixelType.PT_UCHAR; //Optional.
//If the raster catalog is a regular raster catalog, define this parameter.
mdParameters.MinCellsizeFieldName="MinPS";
mdParameters.MaxCellsizeFieldName="MaxPS";
//Create the referenced mosaic dataset.
//Name represents the name of the mosaic dataset, SR represents the spatial reference,
//and catalog can be the input raster catalog or mosaic dataset.
IMosaicDataset md=mosaicWsExtension.CreateReferencedMosaicDataset
(MosaicDatasetName, SR, catalog, null, mdParameters);
}
[VB.NET] Public Sub CreateReferencedMoaic(ByVal ws As IWorkspace, ByVal MosaicDatasetName As String, ByVal catalog As IRasterCatalog, ByVal SR As ISpatialReference)
'Use the IMosaicWorkspaceExtensionHelper class to obtain a MosaicWorkspaceExtension class
'from a workspace (ws).
Dim MosaicWsHelper As IMosaicWorkspaceExtensionHelper
MosaicWsHelper=New MosaicWorkspaceExtensionHelperClass()
Dim mosaicWsExtension As IMosaicWorkspaceExtension
mosaicWsExtension=MosaicWsHelper.FindExtension(ws)
'Define the parameters for creating a referenced mosaic dataset.
Dim mdParameters As ICreateMosaicDatasetParameters
mdParameters=New CreateMosaicDatasetParametersClass()
mdParameters.BandCount=3 'Optional.
mdParameters.PixelType=rstPixelType.PT_UCHAR 'Optional.
'If the raster catalog is a regular raster catalog, define this parameter.
mdParameters.MinCellsizeFieldName="MinPS"
mdParameters.MaxCellsizeFieldName="MaxPS"
'Create the referenced mosaic dataset.
'Name represents the name of the mosaic dataset, SR represents the spatial reference,
'and catalog can be the input raster catalog or mosaic dataset.
Dim md As IMosaicDataset=mosaicWsExtension.CreateReferencedMosaicDataset(MosaicDatasetName, SR, catalog, Nothing, mdParameters)
End Sub
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 Desktop Standard | ArcGIS Desktop Standard |
ArcGIS Desktop Advanced | ArcGIS Desktop Advanced |