ESM:
import * as lengthOperator from "@arcgis/core/geometry/operators/lengthOperator.js";
CDN:
const lengthOperator = await $arcgis.import("@arcgis/core/geometry/operators/lengthOperator.js");
Object:
@arcgis/core/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
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
execute(geometry, options){Number}
-
Calculates the planar length of the input geometry.
Parametersgeometry GeometryUnionThe geometry to calculate the length from.
options ObjectoptionalAdditional options.
Specificationunit LengthUnitoptionalThe 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.
ReturnsType Description Number Returns the planar length of the geometry. Example// Calculate the length of a polyline const length = lengthOperator.execute(polyline);