ArcGIS Pro 3.4 API Reference Guide
ArcGIS.Core.Geometry Namespace / IGeometryEngine Interface / GeodeticDistance Method
The first input geometry. Cannot be null.
The second input geometry. Cannot be null.
The units of the output. If null, then the output is in meters.
The GeodeticCurveType to use when calculating the distance. The ShapePreserving type is equivalent to Geodesic for this method.

In This Topic
    GeodeticDistance Method (IGeometryEngine)
    In This Topic
    Gets the shortest geodetic distance between two geometries.
    Syntax

    Parameters

    geometry1
    The first input geometry. Cannot be null.
    geometry2
    The second input geometry. Cannot be null.
    distanceUnit
    The units of the output. If null, then the output is in meters.
    curveType
    The GeodeticCurveType to use when calculating the distance. The ShapePreserving type is equivalent to Geodesic for this method.

    Return Value

    The calculated geodetic distance between the two geometries in distanceUnit. If distanceUnit is null, then the distance is in meters.

    If at least one geometry is empty, then NaN is returned.

    Exceptions
    ExceptionDescription
    Geometry is null or both geometry's spatial references are null.
    The spatial references are not equal.
    The method is not implemented for GeometryBag or Multipatch.
    Spatial reference of at least one of the geometries is an image coordinate system.
    Remarks
    If one of the spatial references is null and the other is not null and not an image coordinate system, then the non-null spatial reference is used. If both spatial references are null, then an exception is thrown. If both spatial references are not null but not equal, then an exception is thrown. If one of the spatial references is an image coordinate system, then an exception is thrown.
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3.4 or higher.
    See Also