可以使用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);