diff --git a/src/ol/proj.js b/src/ol/proj.js
index 9dc6fb180f..d16bc58480 100644
--- a/src/ol/proj.js
+++ b/src/ol/proj.js
@@ -5,7 +5,7 @@ import {getDistance} from './sphere.js';
import {applyTransform} from './extent.js';
import {modulo} from './math.js';
import {toEPSG4326, fromEPSG4326, PROJECTIONS as EPSG3857_PROJECTIONS} from './proj/epsg3857.js';
-import EPSG4326 from './proj/EPSG4326.js';
+import {PROJECTIONS as EPSG4326_PROJECTIONS} from './proj/epsg4326.js';
import Projection from './proj/Projection.js';
import Units from './proj/Units.js';
import * as projections from './proj/projections.js';
@@ -439,14 +439,10 @@ export function addCommon() {
// Add transformations that don't alter coordinates to convert within set of
// projections with equal meaning.
addEquivalentProjections(EPSG3857_PROJECTIONS);
- addEquivalentProjections(EPSG4326.PROJECTIONS);
+ addEquivalentProjections(EPSG4326_PROJECTIONS);
// Add transformations to convert EPSG:4326 like coordinates to EPSG:3857 like
// coordinates and back.
- addEquivalentTransforms(
- EPSG4326.PROJECTIONS,
- EPSG3857_PROJECTIONS,
- fromEPSG4326,
- toEPSG4326);
+ addEquivalentTransforms(EPSG4326_PROJECTIONS, EPSG3857_PROJECTIONS, fromEPSG4326, toEPSG4326);
}
addCommon();
diff --git a/src/ol/proj/EPSG4326.js b/src/ol/proj/EPSG4326.js
deleted file mode 100644
index 19a71d1a4a..0000000000
--- a/src/ol/proj/EPSG4326.js
+++ /dev/null
@@ -1,79 +0,0 @@
-/**
- * @module ol/proj/EPSG4326
- */
-import {inherits} from '../index.js';
-import Projection from '../proj/Projection.js';
-import Units from '../proj/Units.js';
-const _ol_proj_EPSG4326_ = {};
-
-
-/**
- * @classdesc
- * Projection object for WGS84 geographic coordinates (EPSG:4326).
- *
- * Note that OpenLayers does not strictly comply with the EPSG definition.
- * The EPSG registry defines 4326 as a CRS for Latitude,Longitude (y,x).
- * OpenLayers treats EPSG:4326 as a pseudo-projection, with x,y coordinates.
- *
- * @constructor
- * @extends {ol.proj.Projection}
- * @param {string} code Code.
- * @param {string=} opt_axisOrientation Axis orientation.
- * @private
- */
-_ol_proj_EPSG4326_.Projection_ = function(code, opt_axisOrientation) {
- Projection.call(this, {
- code: code,
- units: Units.DEGREES,
- extent: _ol_proj_EPSG4326_.EXTENT,
- axisOrientation: opt_axisOrientation,
- global: true,
- metersPerUnit: _ol_proj_EPSG4326_.METERS_PER_UNIT,
- worldExtent: _ol_proj_EPSG4326_.EXTENT
- });
-};
-inherits(_ol_proj_EPSG4326_.Projection_, Projection);
-
-
-/**
- * Radius of WGS84 sphere
- *
- * @const
- * @type {number}
- */
-_ol_proj_EPSG4326_.RADIUS = 6378137;
-
-
-/**
- * Extent of the EPSG:4326 projection which is the whole world.
- *
- * @const
- * @type {ol.Extent}
- */
-_ol_proj_EPSG4326_.EXTENT = [-180, -90, 180, 90];
-
-
-/**
- * @const
- * @type {number}
- */
-_ol_proj_EPSG4326_.METERS_PER_UNIT = Math.PI * _ol_proj_EPSG4326_.RADIUS / 180;
-
-
-/**
- * Projections equal to EPSG:4326.
- *
- * @const
- * @type {Array.
}
- */
-_ol_proj_EPSG4326_.PROJECTIONS = [
- new _ol_proj_EPSG4326_.Projection_('CRS:84'),
- new _ol_proj_EPSG4326_.Projection_('EPSG:4326', 'neu'),
- new _ol_proj_EPSG4326_.Projection_('urn:ogc:def:crs:EPSG::4326', 'neu'),
- new _ol_proj_EPSG4326_.Projection_('urn:ogc:def:crs:EPSG:6.6:4326', 'neu'),
- new _ol_proj_EPSG4326_.Projection_('urn:ogc:def:crs:OGC:1.3:CRS84'),
- new _ol_proj_EPSG4326_.Projection_('urn:ogc:def:crs:OGC:2:84'),
- new _ol_proj_EPSG4326_.Projection_('http://www.opengis.net/gml/srs/epsg.xml#4326', 'neu'),
- new _ol_proj_EPSG4326_.Projection_('urn:x-ogc:def:crs:EPSG:4326', 'neu')
-];
-export default _ol_proj_EPSG4326_;
diff --git a/src/ol/proj/epsg4326.js b/src/ol/proj/epsg4326.js
new file mode 100644
index 0000000000..868f8e96f0
--- /dev/null
+++ b/src/ol/proj/epsg4326.js
@@ -0,0 +1,76 @@
+/**
+ * @module ol/proj/epsg4326
+ */
+import {inherits} from '../index.js';
+import Projection from '../proj/Projection.js';
+import Units from '../proj/Units.js';
+
+
+/**
+ * Semi-major radius of the WGS84 ellipsoid.
+ *
+ * @const
+ * @type {number}
+ */
+export const RADIUS = 6378137;
+
+
+/**
+ * Extent of the EPSG:4326 projection which is the whole world.
+ *
+ * @const
+ * @type {ol.Extent}
+ */
+export const EXTENT = [-180, -90, 180, 90];
+
+
+/**
+ * @const
+ * @type {number}
+ */
+export const METERS_PER_UNIT = Math.PI * RADIUS / 180;
+
+
+/**
+ * @classdesc
+ * Projection object for WGS84 geographic coordinates (EPSG:4326).
+ *
+ * Note that OpenLayers does not strictly comply with the EPSG definition.
+ * The EPSG registry defines 4326 as a CRS for Latitude,Longitude (y,x).
+ * OpenLayers treats EPSG:4326 as a pseudo-projection, with x,y coordinates.
+ *
+ * @constructor
+ * @extends {ol.proj.Projection}
+ * @param {string} code Code.
+ * @param {string=} opt_axisOrientation Axis orientation.
+ */
+function EPSG4326Projection(code, opt_axisOrientation) {
+ Projection.call(this, {
+ code: code,
+ units: Units.DEGREES,
+ extent: EXTENT,
+ axisOrientation: opt_axisOrientation,
+ global: true,
+ metersPerUnit: METERS_PER_UNIT,
+ worldExtent: EXTENT
+ });
+}
+inherits(EPSG4326Projection, Projection);
+
+
+/**
+ * Projections equal to EPSG:4326.
+ *
+ * @const
+ * @type {Array.}
+ */
+export const PROJECTIONS = [
+ new EPSG4326Projection('CRS:84'),
+ new EPSG4326Projection('EPSG:4326', 'neu'),
+ new EPSG4326Projection('urn:ogc:def:crs:EPSG::4326', 'neu'),
+ new EPSG4326Projection('urn:ogc:def:crs:EPSG:6.6:4326', 'neu'),
+ new EPSG4326Projection('urn:ogc:def:crs:OGC:1.3:CRS84'),
+ new EPSG4326Projection('urn:ogc:def:crs:OGC:2:84'),
+ new EPSG4326Projection('http://www.opengis.net/gml/srs/epsg.xml#4326', 'neu'),
+ new EPSG4326Projection('urn:x-ogc:def:crs:EPSG:4326', 'neu')
+];
diff --git a/test/spec/ol/proj.test.js b/test/spec/ol/proj.test.js
index b7d9a5e02c..f4a9f3583c 100644
--- a/test/spec/ol/proj.test.js
+++ b/test/spec/ol/proj.test.js
@@ -13,7 +13,7 @@ import {
} from '../../../src/ol/proj.js';
import {register} from '../../../src/ol/proj/proj4.js';
import {HALF_SIZE} from '../../../src/ol/proj/epsg3857.js';
-import _ol_proj_EPSG4326_ from '../../../src/ol/proj/EPSG4326.js';
+import {METERS_PER_UNIT} from '../../../src/ol/proj/epsg4326.js';
import Projection from '../../../src/ol/proj/Projection.js';
@@ -600,8 +600,7 @@ describe('ol.proj', function() {
it('returns value in meters', function() {
const epsg4326 = getProjection('EPSG:4326');
- expect(epsg4326.getMetersPerUnit()).to.eql(
- _ol_proj_EPSG4326_.METERS_PER_UNIT);
+ expect(epsg4326.getMetersPerUnit()).to.eql(METERS_PER_UNIT);
});
it('works for proj4js projections without units', function() {