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,y coordinates in a map space, use the following code:
[Java]
static void identifyPixelValue(IRaster raster, double xMap, double yMap)throws
Exception{
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.
Object pixelValue = raster2.getPixelValue(0, col, row);
}
Development licensing | Deployment licensing |
---|---|
ArcView | ArcView |
ArcEditor | ArcEditor |
ArcInfo | ArcInfo |
Engine Developer Kit | Engine Runtime |