ArcGIS Pro 3.2 API Reference Guide
ArcGIS.Desktop.Mapping Namespace / RasterLayer Class
Members Example

In This Topic
    RasterLayer Class
    In This Topic
    Represents a raster layer.
    Object Model
    RasterLayer ClassCIMRasterColorizer ClassCIMRasterColorizer ClassCIMDataConnection ClassTimeExtent ClassCIMBaseLayer ClassLineOfSightResult ClassRaster ClassCIMRenderingRule ClassSpatialReference ClassTimeParameters ClassMap ClassILayerContainer InterfaceEnvelope Class
    Syntax
    Remarks
    The raster layer is a representation of a file or geodatabase raster dataset. The raster layer is drawn based on the ArcGIS.Core.CIM.CIMRasterColorizer
    Example
    Create a raster layer
    string url = @"C:\Images\Italy.tif";
    await QueuedTask.Run(() =>
    {
      // Create a raster layer using a path to an image.
      // Note: You can create a raster layer from a url, project item, or data connection.
      rasterLayer = LayerFactory.Instance.CreateLayer(new Uri(url), aMap) as RasterLayer;
    });
    Create a raster layer with a new colorizer definition
      // Create a new stretch colorizer definition using default constructor.
      StretchColorizerDefinition stretchColorizerDef = new StretchColorizerDefinition();
      var rasterLayerCreationParams = new RasterLayerCreationParams(new Uri(url))
      {
        ColorizerDefinition = stretchColorizerDef,
        Name = layerName,
        MapMemberIndex = 0
      };
      await QueuedTask.Run(() =>
      {
        // Create a raster layer using the colorizer definition created above.
        // Note: You can create a raster layer from a url, project item, or data connection.
        RasterLayer rasterLayerfromURL =
    LayerFactory.Instance.CreateLayer<RasterLayer>(rasterLayerCreationParams, aMap);
      });
    Access rows in a raster attribute table
    var raster = MapView.Active.Map.GetLayersAsFlattenedList().OfType<RasterLayer>().FirstOrDefault();
    if (raster != null)
    {
      await QueuedTask.Run(() =>
      {
        var rasterTbl = raster.GetRaster().GetAttributeTable();
        var cursor = rasterTbl.Search();
        while (cursor.MoveNext())
        {
          var row = cursor.Current;
        }
      });
    }
    Inheritance Hierarchy

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

    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3 or higher.
    See Also