ArcGIS Pro 3.4 API Reference Guide
ArcGIS.Desktop.Mapping Namespace / ImageMosaicSubLayer Class
Members Example

In This Topic
    ImageMosaicSubLayer Class
    In This Topic
    Represents the image sub-layer of a mosaic layer.
    Object Model
    ImageMosaicSubLayer ClassDefinitionQuery ClassCIMRasterColorizer ClassCIMRasterColorizer ClassCIMDataConnection ClassTimeExtent ClassCIMBaseLayer ClassElevationTypeDefinition ClassCIMMosaicRule ClassRaster ClassCIMRenderingRule ClassSpatialReference ClassTimeParameters ClassSurfaceZsResult ClassMap ClassILayerContainer InterfaceEnvelope ClassDefinitionQuery Class
    Syntax
    Remarks
    This class can be used to distinguish raster layers which are sub-layers of a mosaic layer from other types of raster layers.
    Example
    Update the raster colorizer on a mosaic layer
    await QueuedTask.Run(() =>
    {
      // Get the image sub-layer from the mosaic layer.
      ImageMosaicSubLayer mosaicImageSubLayer = mosaicLayer.GetImageLayer();
      // Get the colorizer from the image sub-layer.
      CIMRasterColorizer rasterColorizer = mosaicImageSubLayer.GetColorizer();
      // Update raster colorizer properties.
      rasterColorizer.Brightness = 10;
      rasterColorizer.Contrast = -5;
      rasterColorizer.ResamplingType = RasterResamplingType.NearestNeighbor;
      // Update the image sub-layer with the changed colorizer.
      mosaicImageSubLayer.SetColorizer(rasterColorizer);
    });
    Update the RGB colorizer on a mosaic layer
    await QueuedTask.Run(() =>
    {
      // Get the image sub-layer from the mosaic layer.
      ImageMosaicSubLayer mosaicImageSubLayer = mosaicLayer.GetImageLayer();
      // Get the colorizer from the image sub-layer.
      CIMRasterColorizer rColorizer = mosaicImageSubLayer.GetColorizer();
      // Check if the colorizer is an RGB colorizer.
      if (rColorizer is CIMRasterRGBColorizer rasterRGBColorizer)
      {
        // Update RGB colorizer properties.
        rasterRGBColorizer.StretchType = RasterStretchType.ESRI;
        // Update the image sub-layer with the changed colorizer.
        mosaicImageSubLayer.SetColorizer(rasterRGBColorizer);
      }
    });
    Check if a certain colorizer can be applied to a mosaic layer
      await QueuedTask.Run(() =>
      {
        // Get the image sub-layer from the mosaic layer.
        ImageMosaicSubLayer mosaicImageSubLayer = mosaicLayer.GetImageLayer();
        // Get the list of colorizers that can be applied to the image sub-layer.
        IEnumerable<RasterColorizerType> applicableColorizerList =
    mosaicImageSubLayer.GetApplicableColorizers();
        // Check if the RGB colorizer is part of the list.
        bool isTrue_ContainTheColorizerType =
    applicableColorizerList.Contains(RasterColorizerType.RGBColorizer);
      });
    Create a new colorizer based on a default colorizer definition and apply it to the mosaic layer
    await QueuedTask.Run(async () =>
    {
      // Get the image sub-layer from the mosaic layer.
      ImageMosaicSubLayer mosaicImageSubLayer = mosaicLayer.GetImageLayer();
      // Check if the Stretch colorizer can be applied to the image sub-layer.
      if (mosaicImageSubLayer.GetApplicableColorizers().Contains(RasterColorizerType.StretchColorizer))
      {
        // Create a new Stretch Colorizer Definition using the default constructor.
        StretchColorizerDefinition stretchColorizerDef_default = new StretchColorizerDefinition();
        // Create a new Stretch colorizer using the colorizer definition created above.
        CIMRasterStretchColorizer newStretchColorizer_default =
    await mosaicImageSubLayer.CreateColorizerAsync(stretchColorizerDef_default) as CIMRasterStretchColorizer;
        // Set the new colorizer on the image sub-layer.
        mosaicImageSubLayer.SetColorizer(newStretchColorizer_default);
      }
    });
    Create a new colorizer based on a custom colorizer definition and apply it to the mosaic layer
    await QueuedTask.Run(async () =>
    {
      // Get the image sub-layer from the mosaic layer.
      ImageMosaicSubLayer mosaicImageSubLayer = mosaicLayer.GetImageLayer();
      // Check if the Stretch colorizer can be applied to the image sub-layer.
      if (mosaicImageSubLayer.GetApplicableColorizers().Contains(RasterColorizerType.StretchColorizer))
      {
        // Create a new Stretch colorizer definition specifying parameters
        // for band index, stretch type, gamma and color ramp.
        StretchColorizerDefinition stretchColorizerDef_custom =
    new StretchColorizerDefinition(1, RasterStretchType.ESRI, 2, colorRamp);
        // Create a new stretch colorizer using the colorizer definition created above.
        CIMRasterStretchColorizer newStretchColorizer_custom =
    await mosaicImageSubLayer.CreateColorizerAsync(stretchColorizerDef_custom) as CIMRasterStretchColorizer;
        // Set the new colorizer on the image sub-layer.
        mosaicImageSubLayer.SetColorizer(newStretchColorizer_custom);
      }
    });
    Inheritance Hierarchy

    System.Object
       ArcGIS.Desktop.Framework.Contracts.PropertyChangedBase
          ArcGIS.Desktop.Mapping.MapMember
             ArcGIS.Desktop.Mapping.Layer
                ArcGIS.Desktop.Mapping.BasicRasterLayer
                   ArcGIS.Desktop.Mapping.ImageServiceLayer
                      ArcGIS.Desktop.Mapping.ImageMosaicSubLayer

    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3 or higher.
    See Also