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
beta
Returns the planar length of a 2D geometry.
Method Overview
Name | Return Type | Summary | Object |
---|---|---|---|
Calculates the planar length of the input geometry. | lengthOperator |
Method Details
-
execute
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.Parametersgeometry GeometryThe geometry to calculate the length from.
options ObjectoptionalAdditional options.
Specificationunit LengthUnitoptionalThe length unit of the return value. An error will be thrown if this is set for Geographic Coordinate Systems.
ReturnsType Description Number Returns the planar length of the geometry. Example// Calculate the length of a polyline const length = lengthOperator.execute(polyline);