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


How to change mosaic properties on an image service layer (ArcObjects .NET 10.8 SDK)
ArcObjects Help for .NET developers > ArcObjects Help for .NET developers > Developing with ArcGIS > Learning ArcObjects > Managing data > Working with image and raster data > Working with image services and WCS services > How to change mosaic properties on an image service layer

How to change mosaic properties on an image service layer


Summary
Image services 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 an image service layer.

Changing mosaic properties on an image service layer

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

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

    //Get the mosaic rule.
    IImageServerLayer3 isLayer=islayerFile.Layer 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.
    islayerFile.Save();
}
[VB.NET]
Private Shared Sub SetMosaicPropertiesOnISLayer(ByVal layerPath As String)
'Open the layer.
Dim islayerFile As ILayerFile=New LayerFileClass()
islayerFile.Open(layerPath)

'Get the mosaic rule.
Dim isLayer As IImageServerLayer3=TryCast(islayerFile.Layer, 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.
islayerFile.Save()
End Sub


See Also:

How to change mosaic properties on a mosaic 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