zoukankan      html  css  js  c++  java
  • 获取点坐标和高程(C# +ArcEngine93)

    获取点坐标和高程(C# +ArcEngine93)

    添加时间:  2010-12-26   来源:外唐教程网   点击:加载中
    摘要:获取点坐标和高程(C# +ArcEngine93),程序说明:1.需要一个带坐标系的栅格数据.2.关键程序很简单,用关键接口ISurface,方法用ISurface.GetElevation().

    获取点坐标和高程(C# +ArcEngine93)

    程序说明:
    1.需要一个带坐标系的栅格数据.
    2.关键程序很简单,用关键接口ISurface,方法用ISurface.GetElevation(). 

    程序下载


    关键代码如下:

    • ///
    • /// 获取x,y,高程值
    • ///
    • /// 
    • /// 
    • /// 
    • /// 
    • /// 
    • void getXYAndHeight(IRaster raster, IPoint point, out double ptX, out double ptY, out double ptHeight)
    • {
    • ptX = 0.0;
    • ptY = 0.0;
    • ptHeight = 0.0;
    • try
    • {
    • IGeoDataset geoDt = raster as IGeoDataset;
    • ISpatialReference spatialreference = geoDt.SpatialReference;
    • IRasterSurface rasterSurface = new RasterSurfaceClass();
    • rasterSurface.PutRaster(raster, 0);
    • ISurface surface = rasterSurface as ISurface;
    • if (point.SpatialReference == null)
    • {
    • point.Project(spatialreference);
    • ptX = point.X;
    • ptY = point.Y;
    • //获取高程
    • ptHeight = surface.GetElevation(point);
    • }
    • else
    • {
    • ptX = point.X;
    • ptY = point.Y;
    • //获取高程
    • point.Project(spatialreference);
    • ptHeight = surface.GetElevation(point);
    • }
    • }
    • catch (Exception ex)
    • {
    • MessageBox.Show(ex.Message);
    • }
    • }
    复制代码 <imgid=aimg_77767 alt="1.jpg" src="http://bbs.esrichina-bj.cn/ESRI/attachments/forumid_26/0902241641397d15f06ec630d0.jpg" width="397" status="2" file="attachments/forumid_26/0902241641397d15f06ec630d0.jpg" h="565" w="397" y="1637" x="415" outfunc="null" unselectable="true" initialized="true">
    <imgid=aimg_77768 alt="2.jpg" src="http://bbs.esrichina-bj.cn/ESRI/attachments/forumid_26/0902241641a574220287ebfa42.jpg" width="600" status="2" file="attachments/forumid_26/0902241641a574220287ebfa42.jpg" h="344" w="600" y="2206" x="415" outfunc="null" unselectable="true" initialized="true">
    希望能给初学者一点帮助.
    程序做得不是很完善,欢迎各位修改,提意见.
  • 相关阅读:
    学习ExtJs的几个资源(转)
    使用Qunit对JavaScript进行单元测试
    Google Analytics基础—追踪代码
    Javascript/jquery异步加载使用方法详解(转)
    Javascript中数组的sort方法的分析
    关于asp.net与winform导出excel的代码
    今天遇到的exeSql问题
    转载 highchat的参数 及其说明
    传智播客的qqtab代码
    几个sql小知识
  • 原文地址:https://www.cnblogs.com/xianyin05/p/3083523.html
Copyright © 2011-2022 走看看