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:
- Get IRasterDatasetEdit for the erase operation.
- Cast input IRasterDataset to IRasterDatasetEdit.
See the following code example:
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 datasetTo 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 |
---|---|
ArcView | ArcView |
ArcEditor | ArcEditor |
ArcInfo | ArcInfo |
Engine Developer Kit | Engine Runtime |