读取指定坐标的栅格值

利用IRaster.Read接口一样的可以读取每个PixelBlock的值,输入的参数是行和列,而不是地图坐标

利用IIdentify接口可以读取指定坐标的PixelBlock的值,代码如下

IIdentify identify = (IIdentify)rasterlayer;//rasterLayer是打开的栅格图层

if(identify=null)

return;

IPoint point = new PointClass();
point.PutCoords(longitude, latitude);
IArray array=identify.Identify(point);

if (array != null)
   {
     int arraycount = array.Count;
     for (int i = 0; i < arraycount; i++)
      {
       IRasterIdentifyObj rasterIdentifyobj = (IRasterIdentifyObj)array.get_Element(i);
       if (rasterIdentifyobj !=null&&rasterIdentifyobj.MapTip !="")
       {
        MessageBox("Value:"+rasterIdentifyobj.MapTip)
        }
     }

}

posted @ 2009-07-21 10:53  zhh  阅读(571)  评论(0编辑  收藏  举报