geodeticDistanceOperator

AMD: require(["esri/geometry/operators/geodeticDistanceOperator"], (geodeticDistanceOperator) => { /* code goes here */ });
ESM: import * as geodeticDistanceOperator from "@arcgis/core/geometry/operators/geodeticDistanceOperator.js";
Object: esri/geometry/operators/geodeticDistanceOperator
Since: ArcGIS Maps SDK for JavaScript 4.31
beta

Calculates the shortest geodetic distance between two 2D geometries.

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

Method
execute(geometry1, geometry2, options){Number}

Calculates the shortest geodetic distance between two geometries. Unless the unit option is set, the default is meters.

Parameters
Specification
geometry1 Geometry

The first input geometry.

geometry2 Geometry

The second input geometry.

options Object
optional

Additional options.

Specification
curveType String
optional
Default Value: "geodesic"

The type of geodetic curve used to determine the distance.

Possible Values:"geodesic"|"loxodrome"|"great-elliptic"|"normal-selection"

unit LengthUnit
optional

The length unit of the distance.

Returns
Type Description
Number Returns the distance between the two geometries. Can return NaN for empty geometries.
Example
// Calculate the planar distance between two geometries
if (geodeticDistanceOperator.isLoaded()) {
  const distance = geodeticDistanceOperator.execute(polyline1, polyline2);
}

isLoaded

Method
isLoaded(){Boolean}

Indicates if all dependencies of this module have been loaded.

Returns
Type Description
Boolean Returns true if this module's dependencies have been loaded.

load

Method
load(){Promise}

Loads this module's dependencies. This method must be called first if isLoaded returns false.

Returns
Type Description
Promise Resolves when the dependencies have been loaded.
See also

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.