/** * Finds closest vertices of a 2D geometry using geodesic distance. * * > [!WARNING] * > * > **Notes** * > * > Verify that `isLoaded()` returns `true` before using this module. * > Use `load()` to load this module's dependencies. * * ![Geodesic proximity operator](https://developers.arcgis.com/javascript/latest/assets/references/core/operators/geodesicProximity.avif "Geodesic proximity operator") * * @since 4.31 */ import type Point from "../Point.js"; import type { LengthUnit } from "../../core/units.js"; import type { GeometryUnion } from "../types.js"; import type { ProximityResult } from "./types.js"; /** @since 5.2 */ export interface GeodesicProximityOptions { /** * The length unit of the result distance. * * @default "meters" */ unit?: LengthUnit; } /** * @deprecated * since 5.2. Refactor using \@arcgis/codemod or manually replace usages * with [GeodesicProximityOptions](https://developers.arcgis.com/javascript/latest/references/core/geometry/operators/geodesicProximityOperator/#GeodesicProximityOptions). */ export type Options = GeodesicProximityOptions; /** @since 5.2 */ export interface GeodesicProximityGetNearestCoordinateOptions extends GeodesicProximityOptions { /** * When the parameter is set to true, this function will calculate the left/right side of a polyline or polygon. * Look for the result in the `isRightSide` property of the returned `ProximityResult` object. * * @default false */ calculateLeftRightSide?: boolean; /** * The value controls the error of calculation. * The method uses shape preserving densification to approximate the input segments with great piecewise elliptical arcs. * When the value is zero or NaN, internally the operator uses 0.01 meters. * For other values, unless the `unit` option is set, the default is meters. * * @default NaN */ maxDeviation?: number; /** * When `geometry` is a polygon, the function will test if `point` is inside of the polygon. * Points that are inside of the polygon have zero distance to the polygon. * When set to `false`, the function will not check if the point is inside of the polygon, but will only determine proximity to the boundary. * * @default true */ testPolygonInterior?: boolean; } /** * @deprecated * since 5.2. Refactor using \@arcgis/codemod or manually replace usages * with [GeodesicProximityGetNearestCoordinateOptions](https://developers.arcgis.com/javascript/latest/references/core/geometry/operators/geodesicProximityOperator/#GeodesicProximityGetNearestCoordinateOptions). */ export type GetNearestCoordinateOptions = GeodesicProximityGetNearestCoordinateOptions; /** * Indicates if all dependencies of this module have been loaded. * * @returns Returns `true` if this module's dependencies have been loaded. * @since 5.2 */ export function geodesicProximityIsLoaded(): boolean; /** * Indicates if all dependencies of this module have been loaded. * * @deprecated * since 5.2. Refactor using \@arcgis/codemod or manually replace usages * with [geodesicProximityIsLoaded()](https://developers.arcgis.com/javascript/latest/references/core/geometry/operators/geodesicProximityOperator/#geodesicProximityIsLoaded). * @returns Returns `true` if this module's dependencies have been loaded. */ export function isLoaded(): boolean; /** * Loads this module's dependencies. This method must be called first if `geodesicProximityIsLoaded` returns `false`. * * @returns Resolves when the dependencies have been loaded. * @since 5.2 * @see [geodesicProximityIsLoaded()](https://developers.arcgis.com/javascript/latest/references/core/geometry/operators/geodesicProximityOperator/#geodesicProximityIsLoaded) */ export function geodesicProximityLoad(): Promise; /** * Loads this module's dependencies. This method must be called first if `isLoaded` returns `false`. * * @deprecated * since 5.2. Refactor using \@arcgis/codemod or manually replace usages * with [geodesicProximityLoad()](https://developers.arcgis.com/javascript/latest/references/core/geometry/operators/geodesicProximityOperator/#geodesicProximityLoad). * @returns Resolves when the dependencies have been loaded. * @see [isLoaded()](https://developers.arcgis.com/javascript/latest/references/core/geometry/operators/geodesicProximityOperator/#isLoaded) */ export function load(): Promise; /** * Returns the nearest coordinate on the geometry to the given input point. * The operator interprets all segments in a shape-preserving manner, that is, it treats segments as if they are densified with a small step in the input spatial reference and then the calculation is performed geodesically. * * @param geometry - The input geometry. * @param point - The point used to search for the nearest coordinate in `geometry`. * @param options - Additional options. * @returns Returns the result of proximity operation. * @since 5.2 * @example * if (!geodesicProximityIsLoaded()) { * await geodesicProximityLoad(); * } * * // Calculate the nearest coordinate on a polyline to the given point * const result = geodesicProximityGetNearestCoordinate(polyline, point); */ export function geodesicProximityGetNearestCoordinate(geometry: GeometryUnion, point: Point, options?: GeodesicProximityGetNearestCoordinateOptions): ProximityResult; /** * Returns the nearest coordinate on the geometry to the given input point. * The operator interprets all segments in a shape-preserving manner, that is, it treats segments as if they are densified with a small step in the input spatial reference and then the calculation is performed geodesically. * * @deprecated * since 5.2. Refactor using \@arcgis/codemod or manually replace usages * with [geodesicProximityGetNearestCoordinate()](https://developers.arcgis.com/javascript/latest/references/core/geometry/operators/geodesicProximityOperator/#geodesicProximityGetNearestCoordinate). * @param geometry - The input geometry. * @param point - The point used to search for the nearest coordinate in `geometry`. * @param options - Additional options. * @returns Returns the result of proximity operation. * @example * if (!geodesicProximityIsLoaded()) { * await geodesicProximityLoad(); * } * * // Calculate the nearest coordinate on a polyline to the given point * const result = geodesicProximityGetNearestCoordinate(polyline, point); */ export function getNearestCoordinate(geometry: GeometryUnion, point: Point, options?: GeodesicProximityGetNearestCoordinateOptions): ProximityResult; /** * Returns the nearest vertex on the geometry. * * @param geometry - The input geometry. * @param point - The point used to search for the nearest vertex in the input `geometry`. * @param options - Additional options. * @returns Returns the result of proximity operation. * @since 5.2 * @example * if (!geodesicProximityIsLoaded()) { * await geodesicProximityLoad(); * } * * // Calculate the nearest vertex on a polyline to the given point * const result = geodesicProximityGetNearestVertex(polyline, point); */ export function geodesicProximityGetNearestVertex(geometry: GeometryUnion, point: Point, options?: GeodesicProximityOptions): ProximityResult; /** * Returns the nearest vertex on the geometry. * * @deprecated * since 5.2. Refactor using \@arcgis/codemod or manually replace usages * with [geodesicProximityGetNearestVertex()](https://developers.arcgis.com/javascript/latest/references/core/geometry/operators/geodesicProximityOperator/#geodesicProximityGetNearestVertex). * @param geometry - The input geometry. * @param point - The point used to search for the nearest vertex in the input `geometry`. * @param options - Additional options. * @returns Returns the result of proximity operation. * @example * if (!geodesicProximityIsLoaded()) { * await geodesicProximityLoad(); * } * * // Calculate the nearest vertex on a polyline to the given point * const result = geodesicProximityGetNearestVertex(polyline, point); */ export function getNearestVertex(geometry: GeometryUnion, point: Point, options?: GeodesicProximityOptions): ProximityResult; /** * Returns vertices of the geometry that are closer to the given point than the given radius. * * @param geometry - The input geometry. * @param point - The point used to search for the nearest vertices in `geometry`. * @param searchRadius - The distance to search from the `point` to the nearest vertices in the `geometry`. * Unless the `unit` option is set, the default is meters. * @param maxVertexCountToReturn - The maximum number of vertices that will be returned. Must be a positive number. * @param options - Additional options. * @returns The array of vertices that are in the given search radius to the point. * The array is sorted by distance to the query point, with the closest vertex first. * When there are more than the `maxVertexCountToReturn` vertices to return, it returns the closest vertices. * The array will be empty when `geometry` is empty. * @since 5.2 * @example * if (!geodesicProximityIsLoaded()) { * await geodesicProximityLoad(); * } * * // Calculate the nearest vertices on a polyline to the given point * const result = geodesicProximityGetNearestVertices(polyline, point, 100, 5); */ export function geodesicProximityGetNearestVertices(geometry: GeometryUnion, point: Point, searchRadius: number, maxVertexCountToReturn: number, options?: GeodesicProximityOptions): ProximityResult[]; /** * Returns vertices of the geometry that are closer to the given point than the given radius. * * @deprecated * since 5.2. Refactor using \@arcgis/codemod or manually replace usages * with [geodesicProximityGetNearestVertices()](https://developers.arcgis.com/javascript/latest/references/core/geometry/operators/geodesicProximityOperator/#geodesicProximityGetNearestVertices). * @param geometry - The input geometry. * @param point - The point used to search for the nearest vertices in `geometry`. * @param searchRadius - The distance to search from the `point` to the nearest vertices in the `geometry`. * Unless the `unit` option is set, the default is meters. * @param maxVertexCountToReturn - The maximum number of vertices that will be returned. Must be a positive number. * @param options - Additional options. * @returns The array of vertices that are in the given search radius to the point. * The array is sorted by distance to the query point, with the closest vertex first. * When there are more than the `maxVertexCountToReturn` vertices to return, it returns the closest vertices. * The array will be empty when `geometry` is empty. * @example * if (!geodesicProximityIsLoaded()) { * await geodesicProximityLoad(); * } * * // Calculate the nearest vertices on a polyline to the given point * const result = geodesicProximityGetNearestVertices(polyline, point, 100, 5); */ export function getNearestVertices(geometry: GeometryUnion, point: Point, searchRadius: number, maxVertexCountToReturn: number, options?: GeodesicProximityOptions): ProximityResult[]; /** * Indicates if the operator supports input geometries that contain curves. * The value is `null` or `undefined` until the operator is loaded, then it will always be `true`. * * @since 5.2 */ export const geodesicProximitySupportsCurves: boolean | null | undefined; /** * Indicates if the operator supports input geometries that contain curves. * The value is `null` or `undefined` until the operator is loaded, then it will always be `true`. * * @deprecated * since 5.2. Refactor using \@arcgis/codemod or manually replace usages * with [geodesicProximitySupportsCurves](https://developers.arcgis.com/javascript/latest/references/core/geometry/operators/geodesicProximityOperator/#geodesicProximitySupportsCurves). */ export const supportsCurves: boolean | null | undefined;