With Proj4rs integration, OpenLayers can transform coordinates between arbitrary projections. This demo is the same as the OpenLayers one but here, it uses the proj4rs library instead of the proj4js one.
proj4 OpenLayers
import ImageLayer from 'ol/layer/Image.js'; import ImageWMS from 'ol/source/ImageWMS.js'; import Map from 'ol/Map.js'; import Projection from 'ol/proj/Projection.js'; import View from 'ol/View.js'; import proj4 from 'proj4'; import {ScaleLine, defaults as defaultControls} from 'ol/control.js'; import {fromLonLat} from 'ol/proj.js'; import {register} from 'ol/proj/proj4.js'; ...
proj4rs
import ImageLayer from 'ol/layer/Image.js'; import ImageWMS from 'ol/source/ImageWMS.js'; import Map from 'ol/Map.js'; import Projection from 'ol/proj/Projection.js'; import View from 'ol/View.js'; import {proj4} from 'proj4rs/proj4.js'; import {ScaleLine, defaults as defaultControls} from 'ol/control.js'; import {fromLonLat} from 'ol/proj.js'; import {register} from 'ol/proj/proj4.js'; ...