import { execute, supportsCurves } from "@arcgis/core/geometry/operators/distanceOperator.js";const { execute, 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
Options
Type definition
unit
Property
- 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
execute
Function
Returns the planar distance between two geometries.
- Signature
-
execute (geometry1: GeometryUnion, geometry2: GeometryUnion, options?: Options): 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 = distanceOperator.execute(point1, point2);Variables
supportsCurves
Variable
Indicates if the operator supports input geometries that contain curves.
The value will always be true.
- Type
- boolean