/** * Supports client-side projection workflows between WGS84 and Web Mercator * without requiring loading the [projectOperator](https://developers.arcgis.com/javascript/latest/references/core/geometry/operators/projectOperator/) and its dependencies or using a geometry service. * * Best suited for relatively simple geometries that do not require the full capabilities * of the projectOperator. * * > [!WARNING] * > * > **Known limitations** * > * > * Geometries with true curves are not supported. * > * [Mesh](https://developers.arcgis.com/javascript/latest/references/core/geometry/Mesh/) geometries are not supported. * * @since 4.0 * @see [Sample - Coordinate Conversion component - Custom Formats](https://developers.arcgis.com/javascript/latest/sample-code/coordinate-conversion-custom/) */ import type SpatialReference from "../SpatialReference.js"; import type { GeometryUnion } from "../types.js"; /** * Returns `true` when [project()](https://developers.arcgis.com/javascript/latest/references/core/geometry/support/webMercatorUtils/#project) can handle the inputs. * * Supported cases are limited to conversions between WGS84 and Web Mercator, * or no-op calls where the `source` and `target` are the same [SpatialReference](https://developers.arcgis.com/javascript/latest/references/core/geometry/SpatialReference/). * * @param source - The input [SpatialReference](https://developers.arcgis.com/javascript/latest/references/core/geometry/SpatialReference/) or an object with * `spatialReference` property such as [Geometry](https://developers.arcgis.com/javascript/latest/references/core/geometry/Geometry/) * or [Map](https://developers.arcgis.com/javascript/latest/references/core/Map/). * @param target - The target [SpatialReference](https://developers.arcgis.com/javascript/latest/references/core/geometry/SpatialReference/) or an object with * `spatialReference` property such as [Geometry](https://developers.arcgis.com/javascript/latest/references/core/geometry/Geometry/) * or [Map](https://developers.arcgis.com/javascript/latest/references/core/Map/). * @returns Returns `true` if [project()](https://developers.arcgis.com/javascript/latest/references/core/geometry/support/webMercatorUtils/#project) can handle the `source` and `target` inputs. * @see [project()](https://developers.arcgis.com/javascript/latest/references/core/geometry/support/webMercatorUtils/#project) */ export function canProject(source: object | SpatialReference | null | undefined, target: object | SpatialReference | null | undefined): boolean; /** * Projects the geometry client-side when the input and target spatial references are supported by this module. * * Use this method when the target spatial reference may vary between WGS84 and Web Mercator, * or when needing to handle no-op projections between identical spatial references. * * Use [canProject()](https://developers.arcgis.com/javascript/latest/references/core/geometry/support/webMercatorUtils/#canProject) * to test whether this function can handle the inputs. If the conversion * direction is already known, use [geographicToWebMercator()](https://developers.arcgis.com/javascript/latest/references/core/geometry/support/webMercatorUtils/#geographicToWebMercator) * or [webMercatorToGeographic()](https://developers.arcgis.com/javascript/latest/references/core/geometry/support/webMercatorUtils/#webMercatorToGeographic). If this function cannot * handle the inputs, use [projectOperator](https://developers.arcgis.com/javascript/latest/references/core/geometry/operators/projectOperator/) instead. * * @param geometry - The input geometry. * @param spatialReference - The target [SpatialReference](https://developers.arcgis.com/javascript/latest/references/core/geometry/SpatialReference/) or an object with * `spatialReference` property such as [Geometry](https://developers.arcgis.com/javascript/latest/references/core/geometry/Geometry/) * or [Map](https://developers.arcgis.com/javascript/latest/references/core/Map/). * @returns Returns the projected geometry if the input is supported; otherwise returns `null`. * @see [projectOperator](https://developers.arcgis.com/javascript/latest/references/core/geometry/operators/projectOperator/) * @see [project()](https://developers.arcgis.com/javascript/latest/references/core/rest/geometryService/#project) * @see [ProjectParameters](https://developers.arcgis.com/javascript/latest/references/core/rest/support/ProjectParameters/) */ export function project(geometry: GeometryUnion | null | undefined, spatialReference: SpatialReference | null | undefined): GeometryUnion | null | undefined; /** * Translates the given latitude and longitude (decimal degree) values to Web Mercator XY values. * * @param long - The longitude value to convert. * @param lat - The latitude value to convert. * @returns Returns the converted values in an array. */ export function lngLatToXY(long: number, lat: number): [ number, number ]; /** * Translates the given Web Mercator coordinates to Longitude and Latitude values (decimal degrees). * By default the returned longitude is normalized so that it is within -180 and +180. * * @param x - The X coordinate value to convert. * @param y - The Y coordinate value to convert. * @returns Returns the converted values in an array. */ export function xyToLngLat(x: number, y: number): [ number, number ]; /** * Converts a geometry from the WGS 84 geographic coordinate system (WKID: 4326) to the Web Mercator coordinate system (WKID: 3857). * * This method provides a lightweight, high-performance client-side conversion optimized for this specific transformation. * Geometries containing true curves are not supported. Use [projectOperator](https://developers.arcgis.com/javascript/latest/references/core/geometry/operators/projectOperator/) instead. * * @param geometry - The input geometry to convert. * @returns Returns the converted geometry in Web Mercator units. */ export function geographicToWebMercator(geometry: GeometryUnion): GeometryUnion; /** * Converts a geometry from the Web Mercator coordinate system (WKID: 3857) to the WGS 84 geographic coordinate system (WKID: 4326). * * This method provides a lightweight, high-performance client-side conversion for this specific transformation. * Geometries containing true curves are not supported. Use [projectOperator](https://developers.arcgis.com/javascript/latest/references/core/geometry/operators/projectOperator/) instead. * * @param geometry - The input geometry to convert. * @param isLinear - Indicates whether to preserve continuous coordinate values and skip * longitude normalization. * By default, this method normalizes output longitude values. Specify * `true` to preserve unnormalized values, such as when working with * wrapped world coordinates. Default value is `false`. * @returns Returns the converted geometry in geographic units. */ export function webMercatorToGeographic(geometry: GeometryUnion, isLinear?: boolean): GeometryUnion;