原始线要素类为地理坐标系,如何获取以米为单位的距离?
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了原始线要素类为地理坐标系,如何获取以米为单位的距离?相关的知识,希望对你有一定的参考价值。
可以使用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);
以上是关于原始线要素类为地理坐标系,如何获取以米为单位的距离?的主要内容,如果未能解决你的问题,请参考以下文章