require(["esri/geometry/operators/geodeticDistanceOperator"], (geodeticDistanceOperator) => { /* code goes here */ });
import * as geodeticDistanceOperator from "@arcgis/core/geometry/operators/geodeticDistanceOperator.js";
esri/geometry/operators/geodeticDistanceOperator
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
execute(geometry1, geometry2, options){Number}
-
Calculates the shortest geodetic distance between two geometries. Unless the
unit
option is set, the default is meters.ParametersSpecificationgeometry1 GeometryThe first input geometry.
geometry2 GeometryThe 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-selection"
unit LengthUnitoptionalThe length unit of the distance.
ReturnsType 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); }
-
Loads this module's dependencies. This method must be called first if
isLoaded
returnsfalse
.ReturnsType Description Promise Resolves when the dependencies have been loaded. - See also