import { geodeticUtilsIsLoaded, isLoaded, geodeticUtilsLoad, load, geodeticUtilsCalculateDistanceAndAzimuth } from "@arcgis/core/geometry/operators/geodeticUtilsOperator.js";
Since
ArcGIS Maps SDK for JavaScript 4.34

A set of utilities for working with geodetic calculations.

Notes

Verify that isLoaded() returns true before using this module. Use load() to load this module's dependencies.

Type definitions

GeodeticUtilsOptions

Type definition
Since
ArcGIS Maps SDK for JavaScript 5.2

curveType

Property
Type
Exclude<GeodeticCurveType, "shape-preserving"> | undefined

The type of geodetic curve along which distance will be measured. The default curveType of geodesic returns the shortest distance between point1 and point2.

Default value
"geodesic"

unit

Property
Type
LengthUnit | undefined

The length unit of the distance.

Default value
"meters"

Options

deprecated Type definition

CalculateDistanceAndAzimuthResult

Type definition
Since
ArcGIS Maps SDK for JavaScript 5.2

Object returned by the calculateDistanceAndAzimuth() method. Azimuths are in positive degrees from 0 to 360, measured clockwise from due north.

distance

Property
Type
number

The geodetic distance between point1 and point2.

azimuth12

Property
Type
number

The azimuth in degrees from point1 to point2.

azimuth21

Property
Type
number

The azimuth in degrees from point2 to point1.

For example, Berlin is almost due north of Rome. The azimuth from Rome to Berlin is 3°; close to due north (0°) but a little east. The azimuth from Berlin to Rome is 183°; close to due south (180°) but a little west.

For another example, Shanghai is almost due east of Wuhan. The azimuth from Wuhan to Shanghai is 82°; close to due east (90°) but a little north. The azimuth from Shanghai to Wuhan is 266°; close to due west (270°) but a little south.

Functions

geodeticUtilsIsLoaded

Function
Since
ArcGIS Maps SDK for JavaScript 5.2

Indicates if all dependencies of this module have been loaded.

Signature
geodeticUtilsIsLoaded (): boolean
Returns
boolean

Returns true if this module's dependencies have been loaded.

isLoaded

deprecated Function

Indicates if all dependencies of this module have been loaded.

Signature
isLoaded (): boolean
Returns
boolean

Returns true if this module's dependencies have been loaded.

geodeticUtilsLoad

Function
Since
ArcGIS Maps SDK for JavaScript 5.2

Loads this module's dependencies. This method must be called first if geodeticUtilsIsLoaded returns false.

See also
Signature
geodeticUtilsLoad (): Promise<void>
Returns
Promise<void>

Resolves when the dependencies have been loaded.

load

deprecated Function

Loads this module's dependencies. This method must be called first if isLoaded returns false.

See also
Signature
load (): Promise<void>
Returns
Promise<void>

Resolves when the dependencies have been loaded.

geodeticUtilsCalculateDistanceAndAzimuth

Function
Since
ArcGIS Maps SDK for JavaScript 5.2

Geodetically calculates the distance and direction between two points. Unless the unit option is set, the default is meters.

Calculate Distance and Azimuth operator

Signature
geodeticUtilsCalculateDistanceAndAzimuth (point1: Point, point2: Point, options?: GeodeticUtilsOptions): CalculateDistanceAndAzimuthResult

Parameters

ParameterTypeDescriptionRequired
point1

The starting point.

point2

The ending point.

options

Additional options.

Returns
CalculateDistanceAndAzimuthResult

Returns an object containing the distance and azimuths between the two points.

Example
if (!geodeticUtilsIsLoaded()) {
await geodeticUtilsLoad();
}
const distanceAndAzimuthResult = geodeticUtilsCalculateDistanceAndAzimuth(
new Point({ x: -118.805, y: 34.027, spatialReference: { wkid: 4326 } }),
new Point({ x: -118.802, y: 34.029, spatialReference: { wkid: 4326 } })
);

calculateDistanceAndAzimuth

deprecated Function

Geodetically calculates the distance and direction between two points. Unless the unit option is set, the default is meters.

Calculate Distance and Azimuth operator

Signature
calculateDistanceAndAzimuth (point1: Point, point2: Point, options?: GeodeticUtilsOptions): CalculateDistanceAndAzimuthResult

Parameters

ParameterTypeDescriptionRequired
point1

The starting point.

point2

The ending point.

options

Additional options.

Returns
CalculateDistanceAndAzimuthResult

Returns an object containing the distance and azimuths between the two points.

Example
if (!geodeticUtilsIsLoaded()) {
await geodeticUtilsLoad();
}
const distanceAndAzimuthResult = geodeticUtilsCalculateDistanceAndAzimuth(
new Point({ x: -118.805, y: 34.027, spatialReference: { wkid: 4326 } }),
new Point({ x: -118.802, y: 34.029, spatialReference: { wkid: 4326 } })
);

geodeticUtilsPointFromDistance

Function
Since
ArcGIS Maps SDK for JavaScript 5.2

Geodetically calculates a point location at a defined distance and direction from a known point. Unless the unit option is set, the default is meters.

Point From Distance operator

Signature
geodeticUtilsPointFromDistance (point: Point, distance: number, azimuth: number, options?: GeodeticUtilsOptions): Point | null | undefined

Parameters

ParameterTypeDescriptionRequired
point

Origin location.

distance

Distance from the origin point.

azimuth

Direction in degrees (0 +/- 360) from the origin point, where both 0 and 360 degrees represent due north. A positive azimuth is measured clockwise from north. A negative azimuth is measured counter-clockwise from north.

options

Additional options.

Returns
Point | null | undefined

Returns the new point or null if the point cannot be represented in the spatial reference.

Example
if (!geodeticUtilsIsLoaded()) {
await geodeticUtilsLoad();
}
const point = geodeticUtilsPointFromDistance(
new Point({ x: -118.805, y: 34.027, spatialReference: { wkid: 4326 } }),
350,
45
);

pointFromDistance

deprecated Function

Geodetically calculates a point location at a defined distance and direction from a known point. Unless the unit option is set, the default is meters.

Point From Distance operator

Signature
pointFromDistance (point: Point, distance: number, azimuth: number, options?: GeodeticUtilsOptions): Point | null | undefined

Parameters

ParameterTypeDescriptionRequired
point

Origin location.

distance

Distance from the origin point.

azimuth

Direction in degrees (0 +/- 360) from the origin point, where both 0 and 360 degrees represent due north. A positive azimuth is measured clockwise from north. A negative azimuth is measured counter-clockwise from north.

options

Additional options.

Returns
Point | null | undefined

Returns the new point or null if the point cannot be represented in the spatial reference.

Example
if (!geodeticUtilsIsLoaded()) {
await geodeticUtilsLoad();
}
const point = geodeticUtilsPointFromDistance(
new Point({ x: -118.805, y: 34.027, spatialReference: { wkid: 4326 } }),
350,
45
);