UNPKG

ol

Version:

OpenLayers mapping library

294 lines • 14.5 kB
/** * @param {Array<number>} input Input coordinate array. * @param {Array<number>=} opt_output Output array of coordinate values. * @param {number=} opt_dimension Dimension. * @return {Array<number>} Output coordinate array (new array, same coordinate * values). */ export function cloneTransform(input: number[], opt_output?: number[], opt_dimension?: number): number[]; /** * @param {Array<number>} input Input coordinate array. * @param {Array<number>=} opt_output Output array of coordinate values. * @param {number=} opt_dimension Dimension. * @return {Array<number>} Input coordinate array (same array as input). */ export function identityTransform(input: number[], opt_output?: number[], opt_dimension?: number): number[]; /** * Add a Projection object to the list of supported projections that can be * looked up by their code. * * @param {Projection} projection Projection instance. * @api */ export function addProjection(projection: Projection): void; /** * @param {Array<Projection>} projections Projections. */ export function addProjections(projections: Projection[]): void; /** * Fetches a Projection object for the code specified. * * @param {ProjectionLike} projectionLike Either a code string which is * a combination of authority and identifier such as "EPSG:4326", or an * existing projection object, or undefined. * @return {Projection} Projection object, or null if not in list. * @api */ export function get(projectionLike: string | Projection): Projection; /** * Get the resolution of the point in degrees or distance units. * For projections with degrees as the unit this will simply return the * provided resolution. For other projections the point resolution is * by default estimated by transforming the 'point' pixel to EPSG:4326, * measuring its width and height on the normal sphere, * and taking the average of the width and height. * A custom function can be provided for a specific projection, either * by setting the `getPointResolution` option in the * {@link module:ol/proj/Projection~Projection} constructor or by using * {@link module:ol/proj/Projection~Projection#setGetPointResolution} to change an existing * projection object. * @param {ProjectionLike} projection The projection. * @param {number} resolution Nominal resolution in projection units. * @param {import("./coordinate.js").Coordinate} point Point to find adjusted resolution at. * @param {Units=} opt_units Units to get the point resolution in. * Default is the projection's units. * @return {number} Point resolution. * @api */ export function getPointResolution(projection: string | Projection, resolution: number, point: number[], opt_units?: { DEGREES: string; FEET: string; METERS: string; PIXELS: string; TILE_PIXELS: string; USFEET: string; }): number; /** * Registers transformation functions that don't alter coordinates. Those allow * to transform between projections with equal meaning. * * @param {Array<Projection>} projections Projections. * @api */ export function addEquivalentProjections(projections: Projection[]): void; /** * Registers transformation functions to convert coordinates in any projection * in projection1 to any projection in projection2. * * @param {Array<Projection>} projections1 Projections with equal * meaning. * @param {Array<Projection>} projections2 Projections with equal * meaning. * @param {TransformFunction} forwardTransform Transformation from any * projection in projection1 to any projection in projection2. * @param {TransformFunction} inverseTransform Transform from any projection * in projection2 to any projection in projection1.. */ export function addEquivalentTransforms(projections1: Projection[], projections2: Projection[], forwardTransform: (arg0: number[], arg1?: number[], arg2?: number) => number[], inverseTransform: (arg0: number[], arg1?: number[], arg2?: number) => number[]): void; /** * Clear all cached projections and transforms. */ export function clearAllProjections(): void; /** * @param {Projection|string|undefined} projection Projection. * @param {string} defaultCode Default code. * @return {Projection} Projection. */ export function createProjection(projection: string | Projection, defaultCode: string): Projection; /** * Creates a {@link module:ol/proj~TransformFunction} from a simple 2D coordinate transform * function. * @param {function(import("./coordinate.js").Coordinate): import("./coordinate.js").Coordinate} coordTransform Coordinate * transform. * @return {TransformFunction} Transform function. */ export function createTransformFromCoordinateTransform(coordTransform: (arg0: number[]) => number[]): (arg0: number[], arg1?: number[], arg2?: number) => number[]; /** * Registers coordinate transform functions to convert coordinates between the * source projection and the destination projection. * The forward and inverse functions convert coordinate pairs; this function * converts these into the functions used internally which also handle * extents and coordinate arrays. * * @param {ProjectionLike} source Source projection. * @param {ProjectionLike} destination Destination projection. * @param {function(import("./coordinate.js").Coordinate): import("./coordinate.js").Coordinate} forward The forward transform * function (that is, from the source projection to the destination * projection) that takes a {@link module:ol/coordinate~Coordinate} as argument and returns * the transformed {@link module:ol/coordinate~Coordinate}. * @param {function(import("./coordinate.js").Coordinate): import("./coordinate.js").Coordinate} inverse The inverse transform * function (that is, from the destination projection to the source * projection) that takes a {@link module:ol/coordinate~Coordinate} as argument and returns * the transformed {@link module:ol/coordinate~Coordinate}. * @api */ export function addCoordinateTransforms(source: string | Projection, destination: string | Projection, forward: (arg0: number[]) => number[], inverse: (arg0: number[]) => number[]): void; /** * Transforms a coordinate from longitude/latitude to a different projection. * @param {import("./coordinate.js").Coordinate} coordinate Coordinate as longitude and latitude, i.e. * an array with longitude as 1st and latitude as 2nd element. * @param {ProjectionLike=} opt_projection Target projection. The * default is Web Mercator, i.e. 'EPSG:3857'. * @return {import("./coordinate.js").Coordinate} Coordinate projected to the target projection. * @api */ export function fromLonLat(coordinate: number[], opt_projection?: string | Projection): number[]; /** * Transforms a coordinate to longitude/latitude. * @param {import("./coordinate.js").Coordinate} coordinate Projected coordinate. * @param {ProjectionLike=} opt_projection Projection of the coordinate. * The default is Web Mercator, i.e. 'EPSG:3857'. * @return {import("./coordinate.js").Coordinate} Coordinate as longitude and latitude, i.e. an array * with longitude as 1st and latitude as 2nd element. * @api */ export function toLonLat(coordinate: number[], opt_projection?: string | Projection): number[]; /** * Checks if two projections are the same, that is every coordinate in one * projection does represent the same geographic point as the same coordinate in * the other projection. * * @param {Projection} projection1 Projection 1. * @param {Projection} projection2 Projection 2. * @return {boolean} Equivalent. * @api */ export function equivalent(projection1: Projection, projection2: Projection): boolean; /** * Searches in the list of transform functions for the function for converting * coordinates from the source projection to the destination projection. * * @param {Projection} sourceProjection Source Projection object. * @param {Projection} destinationProjection Destination Projection * object. * @return {TransformFunction} Transform function. */ export function getTransformFromProjections(sourceProjection: Projection, destinationProjection: Projection): (arg0: number[], arg1?: number[], arg2?: number) => number[]; /** * Given the projection-like objects, searches for a transformation * function to convert a coordinates array from the source projection to the * destination projection. * * @param {ProjectionLike} source Source. * @param {ProjectionLike} destination Destination. * @return {TransformFunction} Transform function. * @api */ export function getTransform(source: string | Projection, destination: string | Projection): (arg0: number[], arg1?: number[], arg2?: number) => number[]; /** * Transforms a coordinate from source projection to destination projection. * This returns a new coordinate (and does not modify the original). * * See {@link module:ol/proj~transformExtent} for extent transformation. * See the transform method of {@link module:ol/geom/Geometry~Geometry} and its * subclasses for geometry transforms. * * @param {import("./coordinate.js").Coordinate} coordinate Coordinate. * @param {ProjectionLike} source Source projection-like. * @param {ProjectionLike} destination Destination projection-like. * @return {import("./coordinate.js").Coordinate} Coordinate. * @api */ export function transform(coordinate: number[], source: string | Projection, destination: string | Projection): number[]; /** * Transforms an extent from source projection to destination projection. This * returns a new extent (and does not modify the original). * * @param {import("./extent.js").Extent} extent The extent to transform. * @param {ProjectionLike} source Source projection-like. * @param {ProjectionLike} destination Destination projection-like. * @param {number=} opt_stops Number of stops per side used for the transform. * By default only the corners are used. * @return {import("./extent.js").Extent} The transformed extent. * @api */ export function transformExtent(extent: number[], source: string | Projection, destination: string | Projection, opt_stops?: number): number[]; /** * Transforms the given point to the destination projection. * * @param {import("./coordinate.js").Coordinate} point Point. * @param {Projection} sourceProjection Source projection. * @param {Projection} destinationProjection Destination projection. * @return {import("./coordinate.js").Coordinate} Point. */ export function transformWithProjections(point: number[], sourceProjection: Projection, destinationProjection: Projection): number[]; /** * Set the projection for coordinates supplied from and returned by API methods. * Note that this method is not yet a part of the stable API. Support for user * projections is not yet complete and should be considered experimental. * @param {ProjectionLike} projection The user projection. */ export function setUserProjection(projection: string | Projection): void; /** * Clear the user projection if set. Note that this method is not yet a part of * the stable API. Support for user projections is not yet complete and should * be considered experimental. */ export function clearUserProjection(): void; /** * Get the projection for coordinates supplied from and returned by API methods. * Note that this method is not yet a part of the stable API. Support for user * projections is not yet complete and should be considered experimental. * @returns {?Projection} The user projection (or null if not set). */ export function getUserProjection(): Projection; /** * Use geographic coordinates (WGS-84 datum) in API methods. Note that this * method is not yet a part of the stable API. Support for user projections is * not yet complete and should be considered experimental. */ export function useGeographic(): void; /** * Return a coordinate transformed into the user projection. If no user projection * is set, the original coordinate is returned. * @param {Array<number>} coordinate Input coordinate. * @param {ProjectionLike} sourceProjection The input coordinate projection. * @returns {Array<number>} The input coordinate in the user projection. */ export function toUserCoordinate(coordinate: number[], sourceProjection: string | Projection): number[]; /** * Return a coordinate transformed from the user projection. If no user projection * is set, the original coordinate is returned. * @param {Array<number>} coordinate Input coordinate. * @param {ProjectionLike} destProjection The destination projection. * @returns {Array<number>} The input coordinate transformed. */ export function fromUserCoordinate(coordinate: number[], destProjection: string | Projection): number[]; /** * Return an extent transformed into the user projection. If no user projection * is set, the original extent is returned. * @param {import("./extent.js").Extent} extent Input extent. * @param {ProjectionLike} sourceProjection The input extent projection. * @returns {import("./extent.js").Extent} The input extent in the user projection. */ export function toUserExtent(extent: number[], sourceProjection: string | Projection): number[]; /** * Return an extent transformed from the user projection. If no user projection * is set, the original extent is returned. * @param {import("./extent.js").Extent} extent Input extent. * @param {ProjectionLike} destProjection The destination projection. * @returns {import("./extent.js").Extent} The input extent transformed. */ export function fromUserExtent(extent: number[], destProjection: string | Projection): number[]; /** * Add transforms to and from EPSG:4326 and EPSG:3857. This function is called * by when this module is executed and should only need to be called again after * `clearAllProjections()` is called (e.g. in tests). */ export function addCommon(): void; /** * A projection as {@link module:ol/proj/Projection}, SRS identifier * string or undefined. */ export type ProjectionLike = string | Projection; /** * A transform function accepts an array of input coordinate values, an optional * output array, and an optional dimension (default should be 2). The function * transforms the input coordinate values, populates the output array, and * returns the output array. */ export type TransformFunction = (arg0: number[], arg1?: number[], arg2?: number) => number[]; import Projection from "./proj/Projection.js"; import { METERS_PER_UNIT } from "./proj/Units.js"; export { METERS_PER_UNIT, Projection }; //# sourceMappingURL=proj.d.ts.map