C# 利用IRawPixels接口遍历栅格数据
更新时间:2017年02月10日 11:22:49 作者:杰桀
本文主要介绍了利用IRawPixels接口遍历栅格数据。具有很好的参考价值,下面跟着小编一起来看下吧
AO的版本为10.2,开发的语言是C#。栅格数据来源IRasterDataset接口。
IRasterBandCollection pRasterBandCollection = pRasterDataset as IRasterBandCollection; IRasterBand pRasterBand = pRasterBandCollection.Item(0); IRaster pRaster = (pRasterDataset as IRasterDataset2).CreateFullRaster(); IRawPixels pRawPixels = pRasterBand as IRawPixels; IRasterProps pRasterProps = pRasterBand as IRasterProps; int dHeight = pRasterProps.Height; int dWidth = pRasterProps.Width; IPnt pntSize = new PntClass(); pntSize.SetCoords(dHeight, dWidth); IPnt pPixelBlockOrigin = new PntClass(); pPixelBlockOrigin.SetCoords(0, 0); IPixelBlock pixelBlock = pRaster.CreatePixelBlock(pntSize); pRawPixels.Read(pPixelBlockOrigin, pixelBlock); System.Array arr = (System.Array)(pixelBlock as IPixelBlock3).get_PixelData(0); for (int i = 0; i < dHeight;i++ ) { for (int j = 0; j < dWidth; j++) { float number = 0; float.TryParse(arr.GetValue(i,j).ToString(),out number); } }
以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,同时也希望多多支持脚本之家!
相关文章
C# 9.0新特性——扩展方法GetEnumerator支持foreach循环
这篇文章主要介绍了C# 9.0新特性——扩展方法GetEnumerator支持foreach循环的相关资料,帮助大家更好的理解和学习c# 9.0,感兴趣的朋友可以了解下2020-11-11c# WPF中自定义加载时实现带动画效果的Form和FormItem
这篇文章主要介绍了c# WPF中自定义加载时实现带动画效果的Form和FormItem,帮助大家更好的理解和学习使用c#,感兴趣的朋友可以了解下2021-03-03
最新评论