This document is archived and information here might be outdated.  Recommended version.


How to erase a portion of a geodatabase raster dataset (ArcObjects .NET 10.8 SDK)
ArcObjects Help for .NET developers > ArcObjects Help for .NET developers > Developing with ArcGIS > Learning ArcObjects > Managing data > Working with image and raster data > Accessing raster datasets > How to erase a portion of a geodatabase raster dataset

How to erase a portion of a geodatabase raster dataset


Erasing a portion of a geodatabase raster dataset

This topic shows how to erase a portion of a raster dataset stored in a file geodatabase or an ArcSDE geodatabase. The pixels in the erase extent changes to NoData pixels after the operation. Do the following steps to erase a portion of a geodatabase raster dataset:
  1. Get IRasterDatasetEdit for the erase operation.
  2. Cast input IRasterDataset to IRasterDatasetEdit.

    See the following code example:
[C#]
static void ErasePortionOfGDBRaster(IRasterDataset rasterDataset, IEnvelope
    eraseExtent)
{
    //IRasterDatasetEdit is needed for the erase operation. 
    //Cast input IRasterDataset to IRasterDatasetEdit.
    IRasterDatasetEdit rasterDatasetEdit=(IRasterDatasetEdit)rasterDataset;
    rasterDatasetEdit.Erase(eraseExtent);
}
[VB.NET]
Public Sub ErasePortionOfGDBRaster(ByVal rasterDataset As IRasterDataset, ByVal eraseExtent As IEnvelope)
    'IRasterDatasetEdit is needed for the erase operation.
    'Cast input IRasterDataset to IRasterDatasetEdit.
    Dim rasterDatasetEdit As IRasterDatasetEdit=CType(rasterDataset, IRasterDatasetEdit)
    rasterDatasetEdit.Erase(eraseExtent)
End Sub


See Also:

How to access a raster dataset




To use the code in this topic, reference the following assemblies in your Visual Studio project. In the code files, you will need using (C#) or Imports (VB .NET) directives for the corresponding namespaces (given in parenthesis below if different from the assembly name):
Development licensing Deployment licensing
ArcGIS Desktop Basic ArcGIS Desktop Basic
ArcGIS Desktop Standard ArcGIS Desktop Standard
ArcGIS Desktop Advanced ArcGIS Desktop Advanced
Engine Developer Kit Engine