▾
import { geodeticDistanceIsLoaded, isLoaded, geodeticDistanceLoad, load, geodeticDistanceExecute } from "@arcgis/core/geometry/operators/geodeticDistanceOperator.js";const { geodeticDistanceIsLoaded, isLoaded, geodeticDistanceLoad, load, geodeticDistanceExecute } = await $arcgis.import("@arcgis/core/geometry/operators/geodeticDistanceOperator.js");- Since
- ArcGIS Maps SDK for JavaScript 4.31
Calculates the shortest geodetic distance between two 2D geometries.
Notes
Verify that isLoaded() returns true before using this module.
Use load() to load this module's dependencies.

Type definitions
GeodeticDistanceOptions
- Since
- ArcGIS Maps SDK for JavaScript 5.2
curveType
- Type
- Exclude<GeodeticCurveType, "shape-preserving"> | undefined
The type of geodetic curve used to determine the distance.
- Default value
- "geodesic"
Functions
geodeticDistanceIsLoaded
- Since
- ArcGIS Maps SDK for JavaScript 5.2
Indicates if all dependencies of this module have been loaded.
- Signature
-
geodeticDistanceIsLoaded (): boolean
- Returns
- boolean
Returns
trueif this module's dependencies have been loaded.
isLoaded
Indicates if all dependencies of this module have been loaded.
- Signature
-
isLoaded (): boolean
- Returns
- boolean
Returns
trueif this module's dependencies have been loaded.
geodeticDistanceLoad
- Since
- ArcGIS Maps SDK for JavaScript 5.2
Loads this module's dependencies. This method must be called first if geodeticDistanceIsLoaded returns false.
- See also
- Signature
-
geodeticDistanceLoad (): Promise<void>
load
Loads this module's dependencies. This method must be called first if isLoaded returns false.
- See also
- Signature
-
load (): Promise<void>
geodeticDistanceExecute
- Since
- ArcGIS Maps SDK for JavaScript 5.2
Calculates the shortest geodetic distance between two geometries.
Unless the unit option is set, the default is meters.
- Signature
-
geodeticDistanceExecute (geometry1: GeometryUnion, geometry2: GeometryUnion, options?: GeodeticDistanceOptions): number
Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| geometry1 | The first input geometry. | | |
| geometry2 | The second input geometry. | | |
| options | Additional options. | |
- Returns
- number
Returns the distance between the two geometries. Can return NaN for empty geometries.
- Example
- if (!geodeticDistanceIsLoaded()) {await geodeticDistanceLoad();}// Calculate the geodetic distance between two geometriesconst distance = geodeticDistanceExecute(polyline1, polyline2);
execute
Calculates the shortest geodetic distance between two geometries.
Unless the unit option is set, the default is meters.
- Signature
-
execute (geometry1: GeometryUnion, geometry2: GeometryUnion, options?: GeodeticDistanceOptions): number
Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| geometry1 | The first input geometry. | | |
| geometry2 | The second input geometry. | | |
| options | Additional options. | |
- Returns
- number
Returns the distance between the two geometries. Can return NaN for empty geometries.
- Example
- if (!geodeticDistanceIsLoaded()) {await geodeticDistanceLoad();}// Calculate the geodetic distance between two geometriesconst distance = geodeticDistanceExecute(polyline1, polyline2);