Changing mosaic properties on a mosaic layer
Do the following steps to set mosaic properties on a mosaic layer:
- Open the mosaic layer.
- Get the mosaic rule from the image sublayer.
- Change the mosaic method, operator, and/or other properties.
- Save the mosaic layer.
See the following code example:
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 layerTo 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 |