Parameters
- geometry
- The input geometry. Cannot be null and its spatial reference cannot be null.
Return Value
The calculated geodesic length in meters. If the geometry is empty, then zero is returned.
Exception | Description |
---|---|
System.ArgumentNullException | Geometry is null. |
System.NotImplementedException | The method is not implemented for GeometryBag or Multipatch. |
System.NotImplementedException | Spatial reference of geometryis an image coordinate system. |
var polyline = PolylineBuilder.CreatePolyline(new[] { MapPointBuilder.CreateMapPoint(-10018754.1713946, 10018754.1713946), MapPointBuilder.CreateMapPoint(10018754.1713946, 10018754.1713946) }, SpatialReferences.WebMercator); var length = GeometryEngine.Instance.GeodesicLength(polyline); // length is approx 5243784.5551844323 in meters length = GeometryEngine.Instance.GeodesicLength(polyline, LinearUnit.Miles); // length is approx 3258.33666089067 in miles var polyline2 = GeometryEngine.Instance.Project(polyline, SpatialReferences.WGS84); length = GeometryEngine.Instance.GeodesicLength(polyline2); // length is approx 5243784.55518443 in meters after projecting
Target Platforms: Windows 11, Windows 10, Windows 8.1