Use the IRawPixels interface to traverse raster data, irawpixels raster
The AO version is 10.2 and the developed language is C #. Raster Data Source IRasterDataset interface.
1 IRasterBandCollection pRasterBandCollection = pRasterDataset as IRasterBandCollection; 2 IRasterBand pRasterBand = pRasterBandCollection.Item(0); 3 IRaster pRaster = (pRasterDataset as IRasterDataset2).CreateFullRaster(); 4 IRawPixels pRawPixels = pRasterBand as IRawPixels; 5 IRasterProps pRasterProps = pRasterBand as IRasterProps; 6 int dHeight = pRasterProps.Height; 7 int dWidth = pRasterProps.Width; 8 IPnt pntSize = new PntClass(); 9 pntSize.SetCoords(dHeight, dWidth);10 IPnt pPixelBlockOrigin = new PntClass();11 pPixelBlockOrigin.SetCoords(0, 0);12 IPixelBlock pixelBlock = pRaster.CreatePixelBlock(pntSize);13 pRawPixels.Read(pPixelBlockOrigin, pixelBlock);14 System.Array arr = (System.Array)(pixelBlock as IPixelBlock3).get_PixelData(0);15 for (int i = 0; i < dHeight;i++ ) 16 {17 for (int j = 0; j < dWidth; j++) 18 {19 float number = 0;20 float.TryParse(arr.GetValue(i,j).ToString(),out number); 21 }22 }
Write for the first time and make a record