import { lengthExecute, execute, lengthSupportsCurves, supportsCurves } from "@arcgis/core/geometry/operators/lengthOperator.js";
Since
ArcGIS Maps SDK for JavaScript 4.31

Returns the planar length of a 2D geometry.

Length operator

Type definitions

LengthOptions

Type definition
Since
ArcGIS Maps SDK for JavaScript 5.2

unit

Property
Type
LengthUnit | undefined

The length unit of the return value. The default is the input geometry's spatial reference unit. An error will be thrown if this is set for Geographic Coordinate Systems.

Options

deprecated Type definition
Supertypes
LengthOptions

Functions

lengthExecute

Function
Since
ArcGIS Maps SDK for JavaScript 5.2

Calculates the planar length of the input geometry.

Signature
lengthExecute (geometry: GeometryUnion, options?: LengthOptions): number

Parameters

ParameterTypeDescriptionRequired
geometry

The geometry to calculate the length from.

options

Additional options.

Returns
number

Returns the planar length of the geometry.

Example
// Calculate the length of a polyline
const length = lengthExecute(polyline);

execute

deprecated Function

Calculates the planar length of the input geometry.

Signature
execute (geometry: GeometryUnion, options?: LengthOptions): number

Parameters

ParameterTypeDescriptionRequired
geometry

The geometry to calculate the length from.

options

Additional options.

Returns
number

Returns the planar length of the geometry.

Example
// Calculate the length of a polyline
const length = lengthExecute(polyline);

Variables

lengthSupportsCurves

Variable
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
Default value
true

supportsCurves

deprecated Variable

Indicates if the operator supports input geometries that contain curves. The value will always be true.

Type
ReturnType