Changing mosaic properties on an image service layer
Do the following steps to set mosaic properties on an image service layer:
- Open the image service layer.
- Get the mosaic rule from the layer.
- Change the mosaic method, operator, and/or other properties.
- Save the image service layer.
See the following code example:
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 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 for Desktop Advanced | ArcGIS for Desktop Advanced |
ArcGIS for Desktop Standard | ArcGIS for Desktop Standard |
ArcGIS for Desktop Basic | ArcGIS for Desktop Basic |
Engine Developer Kit | Engine |