▾
import { distanceExecute, execute, distanceSupportsCurves, supportsCurves } from "@arcgis/core/geometry/operators/distanceOperator.js";const { distanceExecute, execute, distanceSupportsCurves, supportsCurves } = await $arcgis.import("@arcgis/core/geometry/operators/distanceOperator.js");- Since
- ArcGIS Maps SDK for JavaScript 4.31
Calculates planar distance between 2D geometries.

Type definitions
DistanceOptions
- Since
- ArcGIS Maps SDK for JavaScript 5.2
unit
- Type
- LengthUnit | undefined
The length unit of the distance. The default is the input geometry's spatial reference unit. An error will be thrown if this is set for Geographic Coordinate Systems.
Functions
distanceExecute
- Since
- ArcGIS Maps SDK for JavaScript 5.2
Returns the planar distance between two geometries.
- Signature
-
distanceExecute (geometry1: GeometryUnion, geometry2: GeometryUnion, options?: DistanceOptions): number
Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| geometry1 | The first input geometry. | | |
| geometry2 | The second input geometry. | | |
| options | Additional options. | |
- Returns
- number
The distance between the two geometries. Can return NaN for empty geometries.
- Example
- // Calculate the planar distance between two pointsconst distance = distanceExecute(point1, point2);
execute
Returns the planar distance between two geometries.
- Signature
-
execute (geometry1: GeometryUnion, geometry2: GeometryUnion, options?: DistanceOptions): number
Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| geometry1 | The first input geometry. | | |
| geometry2 | The second input geometry. | | |
| options | Additional options. | |
- Returns
- number
The distance between the two geometries. Will return NaN if either input geometry is empty.
- Example
- // Calculate the planar distance between two pointsconst distance = distanceExecute(point1, point2);
Variables
distanceSupportsCurves
- Since
- ArcGIS Maps SDK for JavaScript 5.2
Indicates if the operator supports input geometries that contain curves.
The value will always be true.
- Type
- boolean
supportsCurves
Indicates if the operator supports input geometries that contain curves.
The value will always be true.
- Type
- ReturnType