ArcGIS Pro 2.9 API Reference Guide
GeodesicLength(Geometry,LinearUnit) Method
Example 

ArcGIS.Core.Geometry Namespace > GeometryEngine Class > GeodesicLength Method : GeodesicLength(Geometry,LinearUnit) Method
The input geometry. Cannot be null and its spatial reference cannot be null.
Gets the geodesic length of the input geometry.
Syntax
public double GeodesicLength( 
   Geometry geometry,
   LinearUnit lengthUnit
)
Public Overloads Function GeodesicLength( _
   ByVal geometry As Geometry, _
   ByVal lengthUnit As LinearUnit _
) As Double

Parameters

geometry
The input geometry. Cannot be null and its spatial reference cannot be null.
lengthUnit

Return Value

The calculated geodesic length in outputUnits. If outputUnits is null, then the length is in meters.

If the geometry is empty, then zero is returned.

Exceptions
ExceptionDescription
Geometry is null.
The method is not implemented for GeometryBag or Multipatch.
Spatial reference of geometryis an image coordinate system.
Remarks
Geodesic length is calculated by using only the vertices of the geometry and defining the segments between the points as geodesic segments independent of the actual shape of the geometry. A geodesic segment is the shortest path between two points on an ellipsoid. For example, if you have a closed polyline with only two vertices that represents the equator, the length returned will be zero.
Example
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
Requirements

Target Platforms: Windows 11, Windows 10, Windows 8.1

See Also

Reference

GeometryEngine Class
GeometryEngine Members
Overload List