UNPKG

@arcgis/core

Version:

ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API

38 lines (35 loc) 1.45 kB
/** * Calculates planar distance between 2D geometries. * * ![Distance operator](https://developers.arcgis.com/javascript/latest/assets/references/core/operators/distance.png "Distance operator") * * @since 4.31 * @see [Blog - Geodesic or planar: which to use for distance analysis](https://www.esri.com/arcgis-blog/products/arcgis-pro/analytics/geodesic-or-planar-which-to-use-for-distance-analysis) */ import type { LengthUnit } from "../../core/units.js"; import type { GeometryUnion } from "../types.js"; export interface Options { /** * The length unit of the distance. * The default is the input geometry's spatial reference unit. * An error will be thrown if this is set for Geographic Coordinate Systems. */ unit?: LengthUnit; } /** * Returns the planar distance between two geometries. * * @param geometry1 - The first input geometry. * @param geometry2 - The second input geometry. * @param options - Additional options. * @returns The distance between the two geometries. Can return NaN for empty geometries. * @example * // Calculate the planar distance between two points * const distance = distanceOperator.execute(point1, point2); */ export function execute(geometry1: GeometryUnion, geometry2: GeometryUnion, options?: Options): number; /** * Indicates if the operator supports input geometries that contain curves. * The value will always be `true`. */ export const supportsCurves: boolean;