Spec-Zone.ru › OpenLayers

ol/proj


import * as olProj from 'ol/proj';

Functions

addCoordinateTransforms(source, destination, forward, inverse)

proj.js, line 413
import {addCoordinateTransforms} from 'ol/proj';

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.

Name Type Description
source ProjectionLike

Source projection.

destination ProjectionLike

Destination projection.

forward function

The forward transform function (that is, from the source projection to the destination projection) that takes a Coordinate as argument and returns the transformed Coordinate.

inverse function

The inverse transform function (that is, from the destination projection to the source projection) that takes a Coordinate as argument and returns the transformed Coordinate. If the transform function can only transform less dimensions than the input coordinate, it is supposeed to return a coordinate with only the length it can transform. The other dimensions will be taken unchanged from the source.

addEquivalentProjections(projections)

proj.js, line 297
import {addEquivalentProjections} from 'ol/proj';

Registers transformation functions that don't alter coordinates. Those allow to transform between projections with equal meaning.

Name Type Description
projections Array<Projection>

Projections.

addProjection(projection)

proj.js, line 177
import {addProjection} from 'ol/proj';

Add a Projection object to the list of supported projections that can be looked up by their code.

Name Type Description
projection Projection

Projection instance.

clearUserProjection()

proj.js, line 677
import {clearUserProjection} from 'ol/proj';

Clear the user projection if set.

equivalent(projection1, projection2){boolean}

proj.js, line 478
import {equivalent} from 'ol/proj';

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.

Name Type Description
projection1 Projection

Projection 1.

projection2 Projection

Projection 2.

Returns:
Equivalent.

fromLonLat(coordinate, projection){Coordinate}

proj.js, line 437
import {fromLonLat} from 'ol/proj';

Transforms a coordinate from longitude/latitude to a different projection.

Name Type Description
coordinate Coordinate

Coordinate as longitude and latitude, i.e. an array with longitude as 1st and latitude as 2nd element.

projection ProjectionLike | undefined

Target projection. The default is Web Mercator, i.e. 'EPSG:3857'.

Returns:
Coordinate projected to the target projection.

get(projectionLike){Projection | null}

proj.js, line 198
import {get} from 'ol/proj';

Fetches a Projection object for the code specified.

Name Type Description
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.

Returns:
Projection object, or null if not in list.

getPointResolution(projection, resolution, point, units){number}

proj.js, line 235
import {getPointResolution} from 'ol/proj';

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 Projection constructor or by using setGetPointResolution to change an existing projection object.

Name Type Description
projection ProjectionLike

The projection.

resolution number

Nominal resolution in projection units.

point Coordinate

Point to find adjusted resolution at.

units Units | undefined

Units to get the point resolution in. Default is the projection's units.

Returns:
Point resolution.

getTransform(source, destination){TransformFunction}

proj.js, line 586
import {getTransform} from 'ol/proj';

Given the projection-like objects, searches for a transformation function to convert a coordinates array from the source projection to the destination projection.

Name Type Description
source ProjectionLike

Source.

destination ProjectionLike

Destination.

Returns:
Transform function.

getUserProjection(){Projection | null}

proj.js, line 686
import {getUserProjection} from 'ol/proj';

Get the projection for coordinates supplied from and returned by API methods.

Returns:
The user projection (or null if not set).

setUserProjection(projection)

proj.js, line 669
import {setUserProjection} from 'ol/proj';

Set the projection for coordinates supplied from and returned by API methods. This includes all API methods except for those interacting with tile grids, plus FrameState and State.

Name Type Description
projection ProjectionLike

The user projection.

toLonLat(coordinate, projection){Coordinate}

proj.js, line 455
import {toLonLat} from 'ol/proj';

Transforms a coordinate to longitude/latitude.

Name Type Description
coordinate Coordinate

Projected coordinate.

projection ProjectionLike | undefined

Projection of the coordinate. The default is Web Mercator, i.e. 'EPSG:3857'.

Returns:
Coordinate as longitude and latitude, i.e. an array with longitude as 1st and latitude as 2nd element.

transform(coordinate, source, destination){Coordinate}

proj.js, line 608
import {transform} from 'ol/proj';

Transforms a coordinate from source projection to destination projection. This returns a new coordinate (and does not modify the original). If there is no available transform between the two projection, the function will throw an error.

See transformExtent for extent transformation. See the transform method of Geometry and its subclasses for geometry transforms.

Name Type Description
coordinate Coordinate

Coordinate.

source ProjectionLike

Source projection-like.

destination ProjectionLike

Destination projection-like.

Returns:
Coordinate.

transformExtent(extent, source, destination, stops){Extent}

proj.js, line 632
import {transformExtent} from 'ol/proj';

Transforms an extent from source projection to destination projection. This returns a new extent (and does not modify the original).

Name Type Description
extent Extent

The extent to transform.

source ProjectionLike

Source projection-like.

destination ProjectionLike

Destination projection-like.

stops number | undefined

Number of stops per side used for the transform. By default only the corners are used.

Returns:
The transformed extent.

useGeographic()

proj.js, line 696
import {useGeographic} from 'ol/proj';

Use geographic coordinates (WGS-84 datum) in API methods. This includes all API methods except for those interacting with tile grids, plus FrameState and State.

Type Definitions

ProjectionLike{Projection} {string} {undefined}

A projection as Projection, SRS identifier string or undefined.

TransformFunction(input, output, dimension, stride){Array.<number>}

proj.js, line 107

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.

Name Type Description
input Array.<number>
output Array.<number> | undefined
dimension number | undefined
stride number | undefined

Transforms{Object}

Properties:
Name Type Description
forward TransformFunction

The forward transform (from geographic).

inverse TransformFunction

The inverse transform (to geographic).

© 2005-present, OpenLayers Contributors All rights reserved.Licensed under the BSD 2-Clause License.
https://openlayers.org/en/latest/apidoc/module-ol_proj.html

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API