import * as geodeticDistanceOperator from "@arcgis/core/geometry/operators/geodeticDistanceOperator.js";
const geodeticDistanceOperator = await $arcgis.import("@arcgis/core/geometry/operators/geodeticDistanceOperator.js");
@arcgis/core/geometry/operators/geodeticDistanceOperator
Calculates the shortest geodetic distance between two 2D geometries.
Notes
- Verify that
isLoaded()returnstruebefore using this module. - Use
load()to load this module's dependencies.

Property Overview
| Name | Type | Summary | Object |
|---|---|---|---|
Indicates if the operator supports input geometries that contain curves. | geodeticDistanceOperator |
Property Details
-
Indicates if the operator supports input geometries that contain curves. The value is
nullorundefineduntil the operator is loaded, then it will always betrue.
Method Overview
| Name | Return Type | Summary | Object |
|---|---|---|---|
Calculates the shortest geodetic distance between two geometries. | geodeticDistanceOperator | ||
Indicates if all dependencies of this module have been loaded. | geodeticDistanceOperator | ||
Promise | Loads this module's dependencies. | geodeticDistanceOperator |
Method Details
-
execute
Methodexecute(geometry1, geometry2, options){Number} -
Calculates the shortest geodetic distance between two geometries. Unless the
unitoption is set, the default is meters.ParametersSpecificationgeometry1 GeometryUnionThe first input geometry.
geometry2 GeometryUnionThe second input geometry.
options ObjectoptionalAdditional options.
SpecificationcurveType StringoptionalDefault Value: "geodesic"The type of geodetic curve used to determine the distance.
Possible Values:"geodesic"|"loxodrome"|"great-elliptic"|"normal-section"
unit LengthUnitoptionalDefault Value: "meters"The length unit of the distance.
ReturnsType Description Number Returns the distance between the two geometries. Can return NaN for empty geometries. Exampleif (!geodeticDistanceOperator.isLoaded()) { await geodeticDistanceOperator.load(); } // Calculate the geodetic distance between two geometries const distance = geodeticDistanceOperator.execute(polyline1, polyline2);
-
Loads this module's dependencies. This method must be called first if
isLoadedreturnsfalse.ReturnsType Description Promise Resolves when the dependencies have been loaded. - See also