import * as geodeticUtilsOperator from "@arcgis/core/geometry/operators/geodeticUtilsOperator.js";
const geodeticUtilsOperator = await $arcgis.import("@arcgis/core/geometry/operators/geodeticUtilsOperator.js");
@arcgis/core/geometry/operators/geodeticUtilsOperator
A set of utilities for working with geodetic calculations.
Notes
- Verify that
isLoaded()returnstruebefore using this module. - Use
load()to load this module's dependencies.
Method Overview
| Name | Return Type | Summary | Object |
|---|---|---|---|
Geodetically calculates the distance and direction between two points. | geodeticUtilsOperator | ||
Indicates if all dependencies of this module have been loaded. | geodeticUtilsOperator | ||
Promise | Loads this module's dependencies. | geodeticUtilsOperator | |
Geodetically calculates a point location at a defined distance and direction from a known point. | geodeticUtilsOperator |
Method Details
-
calculateDistanceAndAzimuth
MethodcalculateDistanceAndAzimuth(point1, point2, options){CalculateDistanceAndAzimuthResult} -
Geodetically calculates the distance and direction between two points. Unless the
unitoption is set, the default is meters.
ParametersSpecificationpoint1 PointThe starting point.
point2 PointThe ending point.
options ObjectoptionalAdditional options.
SpecificationcurveType StringoptionalDefault Value: "geodesic"The type of geodetic curve along which distance will be measured. The default curveType of geodesic returns the shortest distance between
point1andpoint2.Possible Values:"geodesic"|"loxodrome"|"great-elliptic"|"normal-section"
unit LengthUnitoptionalDefault Value: "meters"The length unit of the distance.
ReturnsType Description CalculateDistanceAndAzimuthResult Returns an object containing the distance and azimuths between the two points. Exampleif (!geodeticUtilsOperator.isLoaded()) { await geodeticUtilsOperator.load(); } const distanceAndAzimuthResult = geodeticUtilsOperator.calculateDistanceAndAzimuth( new Point({ x: -118.805, y: 34.027, spatialReference: { wkid: 4326 } }), new Point({ x: -118.802, y: 34.029, spatialReference: { wkid: 4326 } }) );
-
Loads this module's dependencies. This method must be called first if
isLoadedreturnsfalse.ReturnsType Description Promise Resolves when the dependencies have been loaded. - See also
-
Geodetically calculates a point location at a defined distance and direction from a known point. Unless the
unitoption is set, the default is meters.
ParametersSpecificationpoint PointOrigin location.
distance NumberDistance from the origin point.
azimuth NumberDirection 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 ObjectoptionalAdditional options.
SpecificationcurveType StringoptionalDefault Value: "geodesic"The type of geodetic curve used.
Possible Values:"geodesic"|"loxodrome"|"great-elliptic"|"normal-section"
unit LengthUnitoptionalDefault Value: "meters"The length unit of the distance.
ReturnsExampleif (!geodeticUtilsOperator.isLoaded()) { await geodeticUtilsOperator.load(); } const point = geodeticUtilsOperator.pointFromDistance( new Point({ x: -118.805, y: 34.027, spatialReference: { wkid: 4326 } }), 350, 45 );
Type Definitions
-
Object returned by the calculateDistanceAndAzimuth() method. Azimuths are in positive degrees from 0 to 360, measured clockwise from due north.
- Properties
-
distance Number
The geodetic distance between
point1andpoint2.azimuth12 NumberThe azimuth in degrees from
point1topoint2.azimuth21 NumberThe azimuth in degrees from
point2topoint1.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.