From 39334fa95daad52b9e7a921d8aff191d4a28d435 Mon Sep 17 00:00:00 2001 From: mike-000 <49240900+mike-000@users.noreply.github.com> Date: Thu, 30 Jul 2020 12:24:03 +0100 Subject: [PATCH] check projection can wrap before getting width --- src/ol/coordinate.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/ol/coordinate.js b/src/ol/coordinate.js index 85b31f325c..d34e8cecf9 100644 --- a/src/ol/coordinate.js +++ b/src/ol/coordinate.js @@ -410,10 +410,12 @@ export function toStringXY(coordinate, opt_fractionDigits) { * @return {Coordinate} The coordinate within the real world extent. */ export function wrapX(coordinate, projection) { - const worldWidth = getWidth(projection.getExtent()); - const worldsAway = getWorldsAway(coordinate, projection, worldWidth); - if (worldsAway) { - coordinate[0] -= worldsAway * worldWidth; + if (projection.canWrapX()) { + const worldWidth = getWidth(projection.getExtent()); + const worldsAway = getWorldsAway(coordinate, projection, worldWidth); + if (worldsAway) { + coordinate[0] -= worldsAway * worldWidth; + } } return coordinate; }