How to change mosaic properties on a mosaic layer (ArcObjects .NET 10.6 SDK)
ArcObjects Help for .NET developers > Developing with ArcGIS > Learning ArcObjects > Managing data > Working with image and raster data > Working with Mosaic datasets > How to change mosaic properties on a mosaic layer (ArcObjects .NET 10.6 SDK)

How to change mosaic properties on a mosaic layer


Summary
Mosaic datasets support different mosaic rules. Mosaic rules define the order and overlap handling of multiple images. This topic shows how to programmatically change the mosaic rule for a mosaic layer.

Changing mosaic properties on a mosaic layer

Do the following steps to set mosaic properties on a mosaic layer:
  1. Open the mosaic layer.
  2. Get the mosaic rule from the image sublayer.
  3. Change the mosaic method, operator, and/or other properties.
  4. Save the mosaic layer.

    See the following code example:
[C#]
static void SetMosaicPropertiesOnMosaicLayer(string layerPath)
{
    //Open the layer.
    ILayerFile mlayerFile=new LayerFileClass();
    mlayerFile.Open(layerPath);

    //Get the mosaic rule from the image sublayer.
    IMosaicLayer mLayer=mlayerFile.Layer as IMosaicLayer;
    IImageServerLayer3 isLayer=mLayer.PreviewLayer as IImageServerLayer3;
    IMosaicRule mRule=isLayer.MosaicRule;

    //Modify the mosaic method, operator, and so on.
    mRule.MosaicMethod=esriMosaicMethod.esriMosaicNorthwest;
    mRule.MosaicOperatorType=rstMosaicOperatorType.MT_FIRST;

    //Save the layer.
    mlayerFile.Save();
}
[VB.NET]
Private Shared Sub SetMosaicPropertiesOnMosaicLayer(ByVal mlayerPath As String)
'Open the layer.
Dim mlayerFile As ILayerFile=New LayerFileClass()
mlayerFile.Open(mlayerPath)

'Get the mosaic rule from the image sublayer.
Dim mLayer As IMosaicLayer=TryCast(mlayerFile.Layer, IMosaicLayer)
Dim isLayer As IImageServerLayer3=TryCast(mLayer.PreviewLayer, IImageServerLayer3)
Dim mRule As IMosaicRule=isLayer.MosaicRule

'Modify the mosaic method, operator, and so on.
mRule.MosaicMethod=esriMosaicMethod.esriMosaicNorthwest
mRule.MosaicOperatorType=rstMosaicOperatorType.MT_FIRST

'Save the layer.
mlayerFile.Save()
End Sub


See Also:

How to change mosaic properties on an image service layer




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 Advanced ArcGIS Desktop Advanced
ArcGIS Desktop Standard ArcGIS Desktop Standard
ArcGIS Desktop Basic ArcGIS Desktop Basic
Engine Developer Kit Engine