diff --git a/src/ol/View.js b/src/ol/View.js index b52a7dc595..f0a11fac21 100644 --- a/src/ol/View.js +++ b/src/ol/View.js @@ -401,15 +401,15 @@ class View extends BaseObject { */ this.cancelAnchor_ = undefined; + if (options.projection) { + disableCoordinateWarning(); + } if (options.center) { options.center = fromUserCoordinate(options.center, this.projection_); } if (options.extent) { options.extent = fromUserExtent(options.extent, this.projection_); } - if (options.projection) { - disableCoordinateWarning(); - } this.applyOptions_(options); } diff --git a/src/ol/proj.js b/src/ol/proj.js index f1fb682416..cc0f0d5883 100644 --- a/src/ol/proj.js +++ b/src/ol/proj.js @@ -620,7 +620,7 @@ export function fromUserCoordinate(coordinate, destProjection) { showCoordinateWarning = false; // eslint-disable-next-line no-console console.warn( - 'Call useGeographic() ol/proj once to work with [longitude, latitude] coordinates.' + 'Call useGeographic() from ol/proj once to work with [longitude, latitude] coordinates.' ); } return coordinate; diff --git a/test/node/ol/proj.test.js b/test/node/ol/proj.test.js index 5cf40ab139..9958022f85 100644 --- a/test/node/ol/proj.test.js +++ b/test/node/ol/proj.test.js @@ -930,5 +930,13 @@ describe('ol/proj.js', function () { view.setCenter([15, 47]); expect(callCount).to.be(0); }); + it('is not shown when view projection is configured', function () { + const view = new View({ + projection: 'EPSG:4326', + center: [16, 48], + }); + view.setCenter([15, 47]); + expect(callCount).to.be(0); + }); }); });