Skip to content
import { execute, 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

Options

Type definition

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.

Functions

NameReturn TypeObject

execute

Function

Calculates the planar length of the input geometry.

Signature
execute (geometry: GeometryUnion, options?: Options): 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 = lengthOperator.execute(polyline);

Variables

supportsCurves

Variable

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

Type
boolean
Default value
true