diff --git a/examples/wms-custom-proj.html b/examples/wms-custom-proj.html
index 3251b437e0..6f5c66e51e 100644
--- a/examples/wms-custom-proj.html
+++ b/examples/wms-custom-proj.html
@@ -44,7 +44,7 @@
-
+
diff --git a/examples/wms-custom-proj.js b/examples/wms-custom-proj.js
index cb796551f4..4288518051 100644
--- a/examples/wms-custom-proj.js
+++ b/examples/wms-custom-proj.js
@@ -15,7 +15,7 @@ var projection = ol.proj.addProjection({
// projection's validity extent can be found at http://epsg.io/.
extent: [485869.5728, 76443.1884, 837076.5648, 299941.7864],
// Use data from proj4js to configure the projection's units.
- units: proj4.defs['EPSG:21781'].units
+ units: proj4.defs('EPSG:21781').units
});
// Proj4js provides transform functions between its configured projections.
// The transform is needed for the ScaleLine control. Otherwise this example
diff --git a/examples/wms-image-custom-proj.html b/examples/wms-image-custom-proj.html
index 8c0868f4e9..73be411eac 100644
--- a/examples/wms-image-custom-proj.html
+++ b/examples/wms-image-custom-proj.html
@@ -45,7 +45,7 @@
-
+
diff --git a/externs/proj4js.js b/externs/proj4js.js
index 2544c32a84..bcca8c150e 100644
--- a/externs/proj4js.js
+++ b/externs/proj4js.js
@@ -11,8 +11,9 @@ var proj4 = function() {};
/**
- * @typedef {Object.>}
*/
-proj4.defs;
\ No newline at end of file
+proj4.defs = function(name, opt_def) {};
diff --git a/package.json b/package.json
index 1f7364b9b5..dbf6d6f482 100644
--- a/package.json
+++ b/package.json
@@ -31,7 +31,7 @@
"mocha-phantomjs": "~3.5.0",
"nomnom": "~1.6.2",
"phantomjs": "~1.9.7-5",
- "proj4": "~2.1.4",
+ "proj4": "~2.2.1",
"sinon": "~1.10.2",
"temp": "~0.7.0",
"walk": "~2.3.3"
diff --git a/src/ol/proj/proj.js b/src/ol/proj/proj.js
index 03689ec86a..9578d350f3 100644
--- a/src/ol/proj/proj.js
+++ b/src/ol/proj/proj.js
@@ -479,7 +479,7 @@ ol.proj.get = function(projectionLike) {
projection = projections[code];
if (ol.ENABLE_PROJ4JS && !goog.isDef(projection) &&
goog.isFunction(proj4)) {
- var def = proj4.defs[code];
+ var def = proj4.defs(code);
if (goog.isDef(def)) {
var units = def.units;
if (!goog.isDef(units)) {
@@ -496,7 +496,7 @@ ol.proj.get = function(projectionLike) {
ol.proj.addProjection(projection);
var currentCode, currentDef, currentProj;
for (currentCode in projections) {
- currentDef = proj4.defs[currentCode];
+ currentDef = proj4.defs(currentCode);
if (goog.isDef(currentDef)) {
currentProj = ol.proj.get(currentCode);
if (currentDef === def) {
diff --git a/test/spec/ol/format/wfsformat.test.js b/test/spec/ol/format/wfsformat.test.js
index a20aeee715..411842bf2f 100644
--- a/test/spec/ol/format/wfsformat.test.js
+++ b/test/spec/ol/format/wfsformat.test.js
@@ -6,7 +6,7 @@ describe('ol.format.WFS', function() {
var features, feature;
before(function(done) {
- proj4.defs['urn:x-ogc:def:crs:EPSG:4326'] = proj4.defs['EPSG:4326'];
+ proj4.defs('urn:x-ogc:def:crs:EPSG:4326', proj4.defs('EPSG:4326'));
afterLoadText('spec/ol/format/wfs/topp-states-wfs.xml', function(xml) {
try {
var config = {
diff --git a/test/spec/ol/proj/proj.test.js b/test/spec/ol/proj/proj.test.js
index ea1107d1f9..32ce4449c9 100644
--- a/test/spec/ol/proj/proj.test.js
+++ b/test/spec/ol/proj/proj.test.js
@@ -141,7 +141,7 @@ describe('ol.proj', function() {
it('caches the new Proj4js projections given their srsCode', function() {
var code = 'urn:ogc:def:crs:EPSG:21781';
var srsCode = 'EPSG:21781';
- proj4.defs[code] = proj4.defs[srsCode];
+ proj4.defs(code, proj4.defs(srsCode));
var proj = ol.proj.get(code);
var proj2 = ol.proj.get(srsCode);
expect(ol.proj.equivalent(proj2, proj)).to.be(true);