ArcGIS Pro 3.4 API Reference Guide
ArcGIS.Core.Data.Raster Namespace / RasterDataset Class / CreateFullRaster Method
Example

In This Topic
    CreateFullRaster Method
    In This Topic
    Creates a Raster that has the same properties and all the bands in this raster dataset. This method must be called on the MCT. Use QueuedTask.Run.
    Syntax
    public Raster CreateFullRaster()
    Public Function CreateFullRaster() As Raster

    Return Value

    The Raster created from the raster dataset.
    Example
    Create a raster cursor to iterate through the raster data
    await QueuedTask.Run(() =>
    {
      // Create a full raster from the raster dataset.
      ArcGIS.Core.Data.Raster.Raster raster = rasterDataset.CreateFullRaster();
    
      // Calculate size of pixel blocks to process. Use 1000 or height/width of the raster, whichever is smaller.
      var height = raster.GetHeight();
      var width = raster.GetWidth();
      int pixelBlockHeight = height > 1000 ? 1000 : height;
      int pixelBlockWidth = width > 1000 ? 1000 : width;
    
      // Create the raster cursor using the height and width calculated.
      RasterCursor rasterCursor = raster.CreateCursor(pixelBlockWidth, pixelBlockHeight);
    
      // Use a do-while loop to iterate through the pixel blocks of the raster using the raster cursor.
      do
      {
        // Get the current pixel block from the cursor.
        using (PixelBlock currentPixelBlock = rasterCursor.Current)
        {
          // Do something with the pixel block...
        }
    
        // Once you are done, move to the next pixel block.
      }
      while (rasterCursor.MoveNext());
    });
    Read and Write pixels from and to a raster dataset using pixel blocks
    await QueuedTask.Run(() =>
    {
      // Create a full raster from the raster dataset.
      ArcGIS.Core.Data.Raster.Raster raster = rasterDataset.CreateFullRaster();
    
      // Calculate size of pixel block to create. Use 128 or height/width of the raster, whichever is smaller.
      var height = raster.GetHeight();
      var width = raster.GetWidth();
      int pixelBlockHeight = height > 128 ? 128 : height;
      int pixelBlockWidth = width > 128 ? 128 : width;
    
      // Create a new (blank) pixel block.
      PixelBlock currentPixelBlock = raster.CreatePixelBlock(pixelBlockWidth, pixelBlockHeight);
    
      // Read pixel values from the raster dataset into the pixel block starting from the given top left corner.
      raster.Read(0, 0, currentPixelBlock);
    
      // Do something with the pixel block...
    
      // Write the pixel block to the raster dataset starting from the given top left corner.
      raster.Write(0, 0, currentPixelBlock);
    });
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3 or higher.
    See Also