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


How to access a raster attribute table for an image service (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 > Working with image services and WCS services > How to access a raster attribute table for an image service

How to access a raster attribute table for an image service


Summary
At ArcGIS 10.1, image service supports raster attribute tables on categorical data source. This topic covers how to access raster attribute tables for an image service.

Accessing a raster attribute table for an image service

The following code example shows how to access the attribute table of an image service that serves thematic imagery:
[C#]
public static IRecordSet GetRasterAttributeTable(IImageServer imageServer)
{
    //Get raster attribute table.
    IImageServiceInfo3 isInfo=imageServer.ServiceInfo as IImageServiceInfo3;
    if (isInfo.HasRasterAttributeTable)
        return ((IImageServer4)imageServer).RasterAttributeTable;
    else
        return null;
}
[VB.NET]
Public Shared Function GetRasterAttributeTable(ByVal imageServer As IImageServer) As IRecordSet
'Get raster attribute table.
Dim isInfo As IImageServiceInfo3=TryCast(imageServer.ServiceInfo, IImageServiceInfo3)
If isInfo.HasRasterAttributeTable Then
    Dim recordSet As IRecordSet=DirectCast(imageServer, IImageServer4).RasterAttributeTable
    Return recordSet
Else
    Return Nothing
End If
End Function






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