Engine中如何获取指定位置处像元的行列号及其像素值?

Engine中如何获取栅格图层中指定位置处的像元的行列号及其像素值?
已邀请:

朱新颖

赞同来自:

【解决办法】:
1,可以使用IRaster2.ToPixelColumn(xMap)以及IRaster2.ToPixelRow(yMap)方法将地理坐标转为像元的行列号;

2,使用IRaster2.GetPixelValue(0, col, row);获取像素值。


public 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);
}

要回复问题请先登录注册