Identifying pixel values on a raster
        IRaster2.GetPixelValue can be used to retrieve a pixel value at a given row and column in a pixel space. To get the pixel value by giving x and y coordinates in a map space, use the following code:
      
    [C#]
        
public static void IdentifyPixelValue(IRaster raster, double xMap, double yMap)
{
    IRaster2 raster2 = (IRaster2)raster;
    //Get the column and row by giving x,y coordinates in a map space.
    int col = raster2.ToPixelColumn(xMap);
    int row = raster2.ToPixelRow(yMap);
    //Get the value at a given band.
    double pixelValue = raster2.GetPixelValue(0, col, row);
}
      [VB.NET]
        
Public Sub IdentifyPixelValue(ByVal raster As IRaster, ByVal xMap As Double, ByVal yMap As Double)
    
    Dim raster2 As IRaster2 = CType(raster, IRaster2)
    
    'Get the column and row by giving x,y coordinates in a map space.
    Dim col As Integer = raster2.ToPixelColumn(xMap)
    Dim row As Integer = raster2.ToPixelRow(yMap)
    
    'Get the value at a given band.
    Dim pixelValue As Double = CDbl(raster2.GetPixelValue(0, col, row))
    
End Sub
      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 | 
|---|---|
| ArcView | ArcView | 
| ArcEditor | ArcEditor | 
| ArcInfo | ArcInfo | 
| Engine Developer Kit | Engine Runtime |