Building a raster attribute table
You can build a raster attribute table using the Build Raster Attribute Table Geoprocessing tool. By default, the raster attribute table contains VALUE and COUNT fields. If a table is assigned to the raster dataset as its raster attribute table, it will be attached to the raster dataset and be part of the dataset. This topic shows how to achieve this task using ArcObjects.
Do the following steps to build a raster attribute table:
- Cast to IRasterDatasetEdit2 to build a raster attribute table.
- To build a default raster attribute table with VALUE and COUNT fields use the BuiltAttributeTable method on the IRasterDastsetEdit2 interface.
- To assign an existing table as a raster attribute table use the AlterAttributeTable method on the IRasterDatasetEdit2 interface.
See the following code example:
static void BuildRasterAttributeTable(IRasterDataset rasterDataset, ITable table)
{
//Cast to IRasterDatasetEdit2 to build a raster attribute table.
IRasterDatasetEdit2 rasterDatasetEdit = (IRasterDatasetEdit2)rasterDataset;
//Build a default raster attribute table with VALUE and COUNT fields.
if (table == null)
{
rasterDatasetEdit.BuildAttributeTable();
}
else
{
//Assign the given table as the raster attribute table.
rasterDatasetEdit.AlterAttributeTable(table);
}
}
[VB.NET]
Public Sub BuildRasterAttributeTable(ByVal rasterDataset As IRasterDataset, ByVal table As ITable)
'Cast to IRasterDatasetEdit2 to build a raster attribute table.
Dim rasterDatasetEdit As IRasterDatasetEdit2 = CType(rasterDataset, IRasterDatasetEdit2)
'Build a default raster attribute table with VALUE and COUNT fields.
If table Is Nothing Then
rasterDatasetEdit.BuildAttributeTable()
Else
'Assign the given table as the raster attribute table.
rasterDatasetEdit.AlterAttributeTable(table)
End If
End Sub
See Also:
How to access a raster datasetDevelopment licensing | Deployment licensing |
---|---|
ArcView | ArcView |
ArcEditor | ArcEditor |
ArcInfo | ArcInfo |
Engine Developer Kit | Engine Runtime |