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 for Desktop Basic ArcGIS for Desktop Basic
ArcGIS for Desktop Standard ArcGIS for Desktop Standard
ArcGIS for Desktop Advanced ArcGIS for Desktop Advanced
Engine Developer Kit Engine