ArcGIS Pro 3.1 API Reference Guide
ArcGIS.Core.Data.Raster Namespace / Raster Class
Members Example

In This Topic
    Raster Class
    In This Topic
    Represents an in-memory raster that can perform resampling and reprojection.
    Object Model
    Raster ClassRasterCursor ClassPixelBlock ClassTable ClassRasterBand ClassRasterBand ClassRasterColormap ClassEnvelope ClassBasicRasterDataset ClassSpatialReference ClassRasterDataset Class
    Syntax
    public sealed class Raster : ArcGIS.Core.CoreObjectsBase, System.IDisposable  
    Public NotInheritable Class Raster 
       Inherits ArcGIS.Core.CoreObjectsBase
       Implements System.IDisposable 
    Remarks

    The Raster object is a transient representation of raster data that can perform resampling and reprojection. It can be modified without affecting the source data. This allows the raster to represent what you want, as you may specify a projection, extent, and cell size into which the input data will be transformed. This makes the raster quite useful for performing display or analysis in a coordinate system different from that which is stored in the raster dataset. Because of the transient nature of the raster, any modifications that are made to this object will be lost when the object is released. The modified Raster can be persisted to another raster dataset on disk or in a geodatabase using the SaveAs method. A Raster is most easily understood as a vehicle to provide resampling, projection, and data type conversion from one or more raster bands to a desired output coordinate system.

    A Raster can be obtained in the following ways:

    1. From a ArcGIS.Desktop.Mapping.RasterLayer using ArcGIS.Desktop.Mapping.BasicRasterLayer.GetRaster method.
    2. From a RasterDataset using either RasterDataset.CreateRaster, RasterDataset.CreateFullRaster or BasicRasterDataset.CreateDefaultRaster methods.
    3. From a RasterBand using the BasicRasterDataset.CreateDefaultRaster method.
    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;
        }
      });
    }
    Inheritance Hierarchy

    System.Object
       ArcGIS.Core.CoreObjectsBase
          ArcGIS.Core.Data.Raster.Raster

    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3.0 or higher.
    See Also