Spec-Zone.ru › OpenLayers

ol/proj/proj4


Functions

epsgLookupMapTiler(key){function}

proj/proj4.js, line 258
import {epsgLookupMapTiler} from 'ol/proj/proj4';

Generate an EPSG lookup function which uses the MapTiler Coordinates API to find projection definitions which do not require proj4 to be configured to handle +nadgrids parameters. Call setEPSGLookup use the function for lookups setEPSGLookup(epsgLookupMapTiler('{YOUR_MAPTILER_API_KEY_HERE}')).

Name Type Description
key string

MapTiler API key. Get your own API key at https://www.maptiler.com/cloud/.

Deprecated
  • Not needed any more, the default lookup provides this functionality now.
Returns:
The EPSG lookup function.

fromEPSGCode(code){Promise<Projection>}

proj/proj4.js, line 240
import {fromEPSGCode} from 'ol/proj/proj4';

Get a projection from an EPSG code. This function fetches the projection definition from the spatialreference.org website, registers this definition for use with proj4, and returns a configured projection. You must call import proj4 and call register before using this function.

If the projection definition is already registered with proj4, it will not be fetched again (so it is ok to call this function multiple times with the same code).

Name Type Description
code number | string

The EPSG code (e.g. 4326 or 'EPSG:4326').

Deprecated
  • Use fromProjectionCode instead.
Returns:
The projection.

fromProjectionCode(code){Promise<Projection>}

proj/proj4.js, line 148
import {fromProjectionCode} from 'ol/proj/proj4';

Get a projection from a projection code (i.e., authority:number). This function fetches the projection definition from the https://spatialreference.org website, registers this definition for use with proj4, and returns a configured projection. You must call import proj4 and call register before using this function.

If the projection definition is already registered with proj4, it will not be fetched again (so it is ok to call this function multiple times with the same code).

Name Type Description
code string

The projection code (e.g., 'EPSG:4326' or 'OGC:CRS84').

Returns:
The projection.

register(proj4)

proj/proj4.js, line 44
import {register} from 'ol/proj/proj4';

Make projections defined in proj4 (with proj4.defs()) available in OpenLayers. Requires proj4 >= 2.8.0.

This function should be called whenever changes are made to the proj4 registry, e.g. after calling proj4.defs(). Existing transforms will not be modified by this function.

Name Type Description
proj4 module:proj4

Proj4.

setEPSGLookup(func)

proj/proj4.js, line 210
import {setEPSGLookup} from 'ol/proj/proj4';

Set the lookup function for getting proj4 or WKT definitions given an EPSG code. By default, the fromEPSGCode function uses the spatialreference.org website for WKT definitions. This can be changed by providing a different lookup function.

Name Type Description
func function

The lookup function.

Deprecated
  • Use setProjectionCodeLookup instead.

setProjectionCodeLookup(func)

proj/proj4.js, line 120
import {setProjectionCodeLookup} from 'ol/proj/proj4';

Set the lookup function for getting proj4 or WKT definitions given an projection code. By default, the fromProjectionCode function uses the spatialreference.org website for WKT definitions. This can be changed by providing a different lookup function.

Name Type Description
func function

The lookup function.

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

Spec-Zone.ru

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