import { isLoaded, load, execute, supportsCurves } from "@arcgis/core/geometry/operators/geodeticLengthOperator.js";const { isLoaded, load, execute, supportsCurves } = await $arcgis.import("@arcgis/core/geometry/operators/geodeticLengthOperator.js");- Since
- ArcGIS Maps SDK for JavaScript 4.31
Returns the geodetic length of a 2D geometry.
Notes
Verify that isLoaded() returns true before using this module.
Use load() to load this module's dependencies.
Type definitions
Options
Type definition
curveType
Property
- Type
- GeodeticCurveType | undefined
The type of geodetic curve used to determine the length.
- Default value
- "geodesic"
unit
Property
- Type
- LengthUnit | undefined
The length unit of the return value.
- Default value
- "meters"
Functions
isLoaded
Function
Indicates if all dependencies of this module have been loaded.
- Signature
-
isLoaded (): boolean
- Returns
- boolean
Returns
trueif this module's dependencies have been loaded.
load
Function
Loads this module's dependencies. This method must be called first if isLoaded returns false.
- See also
- Signature
-
load (): Promise<void>
execute
Function
Calculates the geodetic length of the input Geometry.
Unless the unit option is set, the default is meters.
- Signature
-
execute (geometry: GeometryUnion, options?: Options): number
Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| geometry | The input geometry. | | |
| options | Additional options. | |
- Returns
- number
Returns the geodetic length of the input geometry.
Example
if (!geodeticLengthOperator.isLoaded()) { await geodeticLengthOperator.load();}
// Calculate the geodetic length of a polylineconst length = geodeticLengthOperator.execute(polyline);