码迷,mamicode.com
首页 > 其他好文 > 详细

原始线要素类为地理坐标系,如何获取以米为单位的距离?

时间:2016-02-23 11:15:32      阅读:221      评论:0      收藏:0      [点我收藏+]

标签:

可以使用IPolycurveGeodetic.get_LengthGeodetic();方法,将要量测的IPolyline转为IPolycurveGeodetic即可。
测试代码如下:

            IPolyline polyline = feature.Shape as IPolyline;
         
            IPolycurveGeodetic polycurve = polyline as IPolycurveGeodetic;
            ILinearUnitEdit linearUnitEdit = new LinearUnitClass();

            //Define the properties for the linear unit 
            object name = Meter;
            object alias = Meter;
            object abbreviation = M;
            object remarks = Meter is the linear unit;
            object metersPerUnit = 1;
            linearUnitEdit.Define(ref name, ref alias, ref abbreviation, ref remarks, ref metersPerUnit);
            ILinearUnit pLU = linearUnitEdit as ILinearUnit;

            double distance = polycurve.get_LengthGeodetic(esrType.esriGeodeticTypeGeodesic,pLU);

 

原始线要素类为地理坐标系,如何获取以米为单位的距离?

标签:

原文地址:http://www.cnblogs.com/gisoracle/p/5209141.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!