This example shows a GeoJSON layer that is well converted between various projections.
proj4 OpenLayers
import Map from 'ol/Map.js';import TileGrid from 'ol/tilegrid/TileGrid.js'; import View from 'ol/View.js'; import proj4 from 'proj4'; import {getCenter} from 'ol/extent.js'; import {get as getProjection} from 'ol/proj.js'; import {register} from 'ol/proj/proj4.js'; import GeoJSON from 'ol/format/GeoJSON.js'; import Graticule from 'ol/layer/Graticule.js'; import VectorLayer from 'ol/layer/Vector.js'; import VectorSource from 'ol/source/Vector.js'; import {Fill, Style} from 'ol/style.js'; ...
proj4rs
import Map from 'ol/Map.js';import TileGrid from 'ol/tilegrid/TileGrid.js'; import View from 'ol/View.js'; import {proj4} from 'proj4rs/proj4.js'; import {getCenter} from 'ol/extent.js'; import {get as getProjection} from 'ol/proj.js'; import {register} from 'ol/proj/proj4.js'; import GeoJSON from 'ol/format/GeoJSON.js'; import Graticule from 'ol/layer/Graticule.js'; import VectorLayer from 'ol/layer/Vector.js'; import VectorSource from 'ol/source/Vector.js'; import {Fill, Style} from 'ol/style.js'; ...