ol-ishare/proj

Projection support for ol-ishare and ol.

Methods

(inner) addProjection(code, definition) → {ol/proj/Projection~Projection}

import { addProjection } from 'ol-ishare/proj.js';

Adds a projection to ol-ishare and ol using proj4 if available.

proj4 can be registered via calling setProj4 or by exposing proj4 at window.proj4.

Parameters:
Name Type Description
code String

ID of the projection e.g. 'EPSG:27700'

definition String

Projection definition in wkt or proj4 format e.g. '+title=British National Grid +proj=tmerc +lat_0=49 +lon_0=-2 +k=0.9996012717 +x_0=400000 +y_0=-100000 +ellps=airy +datum=OSGB36 +units=m +no_defs'

Returns:

OpenLayers Projection instance

Type
ol/proj/Projection~Projection

(inner) setProj4(proj4) → {Object|undefined}

import { setProj4 } from 'ol-ishare/proj.js';

Set the proj4 instance that ol-ishare and ol will use to define custom projections.

Use addProjection to add a projection to ol-ishare and ol.

Parameters:
Name Type Description
proj4 Object

The proj4 instance

Returns:

The proj4 instance or undefined

Type
Object | undefined

(inner) getProj4() → {Object|undefined}

import { getProj4 } from 'ol-ishare/proj.js';

Attempt to get a reference to the proj4 instance used by ol-ishare and ol to define custom projections. If proj4 is not already registered, this function will attempt to find a reference at window.proj4.

Use addProjection to add a projection to ol-ishare and ol.

Returns:

The proj4 instance or undefined

Type
Object | undefined