ArcGIS Pro 3.0 API Reference Guide
ArcGIS.Desktop.Mapping Namespace / BasicRasterLayer Class / GetRaster Method
Example

In This Topic
    GetRaster Method
    In This Topic
    Returns this basic raster layer's underlying ArcGIS.Core.Data.Raster.Raster object. This method must be called on the MCT. Use QueuedTask.Run.
    Syntax
    public Raster GetRaster()
    Public Function GetRaster() As Raster

    Return Value

    Exceptions
    ExceptionDescription
    This method or property must be called within the lambda passed to QueuedTask.Run.
    Example
    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;
        }
      });
    }
    Requirements

    Target Platforms: Windows 11, Windows 10, Windows 8.1

    See Also