/** * Find the closest vertices of the 2D geometry. * * ![Proximity operator](https://developers.arcgis.com/javascript/latest/assets/references/core/operators/proximity.avif "Proximity operator") * * @since 4.31 * @see [Sample - Geometry operator - proximity analysis](https://developers.arcgis.com/javascript/latest/sample-code/geometry-operator-proximity/) */ 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 ProximityOptions { /** * The length unit of the search radius and result distances. * 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; } /** * @deprecated * since 5.2. Refactor using \@arcgis/codemod or manually replace usages * with [ProximityOptions](https://developers.arcgis.com/javascript/latest/references/core/geometry/operators/proximityOperator/#ProximityOptions). */ export type Options = ProximityOptions; /** @since 5.2 */ export interface ProximityGetNearestCoordinateOptions extends ProximityOptions { /** * 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; /** * 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 [ProximityGetNearestCoordinateOptions](https://developers.arcgis.com/javascript/latest/references/core/geometry/operators/proximityOperator/#ProximityGetNearestCoordinateOptions). */ export type GetNearestCoordinateOptions = ProximityGetNearestCoordinateOptions; /** * Returns the nearest coordinate on the geometry to the given input point. * * @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 proximity result which contains the nearest coordinate on the input `geometry` to the given `point`. * @since 5.2 * @example * // Return the nearest result on a polygon to the given point * const proximityResult = proximityGetNearestCoordinate(polygon, point); */ export function proximityGetNearestCoordinate(geometry: GeometryUnion, point: Point, options?: ProximityGetNearestCoordinateOptions): ProximityResult; /** * Returns the nearest coordinate on the geometry to the given input point. * * @deprecated * since 5.2. Refactor using \@arcgis/codemod or manually replace usages * with [proximityGetNearestCoordinate()](https://developers.arcgis.com/javascript/latest/references/core/geometry/operators/proximityOperator/#proximityGetNearestCoordinate). * @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 proximity result which contains the nearest coordinate on the input `geometry` to the given `point`. * @example * // Return the nearest result on a polygon to the given point * const proximityResult = proximityGetNearestCoordinate(polygon, point); */ export function getNearestCoordinate(geometry: GeometryUnion, point: Point, options?: ProximityGetNearestCoordinateOptions): 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 proximity result which contains the nearest vertex on the `geometry` to the given `point`. * @since 5.2 * @example * // Return the nearest vertex on a polygon to the given point * const proximityResult = proximityGetNearestVertex(polygon, point); */ export function proximityGetNearestVertex(geometry: GeometryUnion, point: Point, options?: ProximityOptions): ProximityResult; /** * Returns the nearest vertex on the geometry. * * @deprecated * since 5.2. Refactor using \@arcgis/codemod or manually replace usages * with [proximityGetNearestVertex()](https://developers.arcgis.com/javascript/latest/references/core/geometry/operators/proximityOperator/#proximityGetNearestVertex). * @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 proximity result which contains the nearest vertex on the `geometry` to the given `point`. * @example * // Return the nearest vertex on a polygon to the given point * const proximityResult = proximityGetNearestVertex(polygon, point); */ export function getNearestVertex(geometry: GeometryUnion, point: Point, options?: ProximityOptions): 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 planar distance from the `point` to search for vertices. * Unless the `unit` option is set, the default is the geometry's spatial reference unit. * @param maxVertexCountToReturn - The maximum number of vertices that will be returned. Must be a positive number. * @param options - Additional options. * @returns Returns an array of proximity results which contain the nearest vertices on `geometry` to the given `point` that are less than or equal to the planar distance of search radius. * 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 * // Return the nearest vertices on a polygon to the given point * const proximityResultsArray = proximityGetNearestVertices(polygon, point, 100, 5); */ export function proximityGetNearestVertices(geometry: GeometryUnion, point: Point, searchRadius: number, maxVertexCountToReturn: number, options?: ProximityOptions): 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 [proximityGetNearestVertices()](https://developers.arcgis.com/javascript/latest/references/core/geometry/operators/proximityOperator/#proximityGetNearestVertices). * @param geometry - The input geometry. * @param point - The point used to search for the nearest vertices in `geometry`. * @param searchRadius - The planar distance from the `point` to search for vertices. * Unless the `unit` option is set, the default is the geometry's spatial reference unit. * @param maxVertexCountToReturn - The maximum number of vertices that will be returned. Must be a positive number. * @param options - Additional options. * @returns Returns an array of proximity results which contain the nearest vertices on `geometry` to the given `point` that are less than or equal to the planar distance of search radius. * 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 * // Return the nearest vertices on a polygon to the given point * const proximityResultsArray = proximityGetNearestVertices(polygon, point, 100, 5); */ export function getNearestVertices(geometry: GeometryUnion, point: Point, searchRadius: number, maxVertexCountToReturn: number, options?: ProximityOptions): ProximityResult[]; /** * Indicates if the operator supports input geometries that contain curves. * The value will always be `true`. * * @since 5.2 */ export const proximitySupportsCurves: boolean; /** * Indicates if the operator supports input geometries that contain curves. * The value will always be `true`. * * @deprecated * since 5.2. Refactor using \@arcgis/codemod or manually replace usages * with [proximitySupportsCurves](https://developers.arcgis.com/javascript/latest/references/core/geometry/operators/proximityOperator/#proximitySupportsCurves). */ export const supportsCurves: ReturnType;