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):
- ESRI.ArcGIS.Carto
- ESRI.ArcGIS.Server
- ESRI.ArcGIS.System (ESRI.ArcGIS.esriSystem)
- ESRI.ArcGIS.Geodatabase
Development licensing | Deployment licensing |
---|---|
ArcGIS for Desktop Advanced | ArcGIS for Desktop Advanced |
ArcGIS for Desktop Standard | ArcGIS for Desktop Standard |
ArcGIS for Desktop Basic | ArcGIS for Desktop Basic |
Engine Developer Kit | Engine |