lengthOperator

AMD: require(["esri/geometry/operators/lengthOperator"], (lengthOperator) => { /* code goes here */ });
ESM: import * as lengthOperator from "@arcgis/core/geometry/operators/lengthOperator.js";
Object: esri/geometry/operators/lengthOperator
Since: ArcGIS Maps SDK for JavaScript 4.31

Returns the planar length of a 2D geometry.

Property Overview

Name Type Summary Object

Indicates if the operator supports input geometries that contain curves.

lengthOperator

Property Details

supportsCurves

Property
supportsCurves Booleanreadonly

Indicates if the operator supports input geometries that contain curves.

Default Value:true

Method Overview

Name Return Type Summary Object

Calculates the planar length of the input geometry.

lengthOperator

Method Details

execute

Method
execute(geometry, options){Number}

Calculates the planar length of the input geometry. Unless the unit option is set, the default is the spatial reference unit of the input geometry.

Parameters
geometry GeometryUnion

The geometry to calculate the length from.

options Object
optional

Additional options.

Specification
unit LengthUnit
optional

The length unit of the return value. An error will be thrown if this is set for Geographic Coordinate Systems.

Returns
Type Description
Number Returns the planar length of the geometry.
Example
// Calculate the length of a polyline
const length = lengthOperator.execute(polyline);

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.