//Returns the length(in meters) of a polyline geometry. private bool MeasurePolyline(IGTPolylineGeometry oPolyLineGeometry, ref double dLength) { bool returnValue = false; try { IGTMeasureService oMeasurementSvc = GTClassFactory.Create <IGTMeasureService>(); int intMeasRefSpace = Convert.ToInt16(m_Application.GetPreference(GTPreferenceConstants.gtpcMeasurementReferenceSpace)); oMeasurementSvc.ReferenceSpace = intMeasRefSpace; oMeasurementSvc.CoordSystem = ((ICoordSystemsMgr)m_Application.DataContext.CoordSystemsMgr).BaseCoordSystem as CoordSystem; //Give the measurement service the geometry oMeasurementSvc.Geometry = oPolyLineGeometry; //Get the length dLength = System.Convert.ToInt16(oMeasurementSvc.Length); // Measurement service returns length in meters. Convert to feet. dLength = Math.Round((dLength / .3048), 0); oMeasurementSvc = null; returnValue = true; } catch (Exception ex) { //MessageBox.Show(Application.ApplicationWindow, ex.Message, System.Convert.ToString(modCPTRes.G3E_I_APP_NAME), MessageBoxButtons.OK, MessageBoxIcon.Exclamation); returnValue = false; } return(returnValue); }