From 6a5a2113a079e622c50a1a32ad5567f1f2899cca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pierre-=C3=89tienne=20Lord?= <7397743+pelord@users.noreply.github.com> Date: Mon, 17 May 2021 08:42:53 -0400 Subject: [PATCH] fix(map utils): conversion to latitude longitude out of bounds (#858) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Pierre-Étienne Lord --- packages/geo/src/lib/map/shared/map.utils.ts | 22 +++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/packages/geo/src/lib/map/shared/map.utils.ts b/packages/geo/src/lib/map/shared/map.utils.ts index 828ab06345..d2f3c86bf9 100644 --- a/packages/geo/src/lib/map/shared/map.utils.ts +++ b/packages/geo/src/lib/map/shared/map.utils.ts @@ -320,13 +320,21 @@ export function stringToLonLat( }; } } - - return { - lonLat, - message: '', - radius: radius ? parseInt(radius, 10) : undefined, - conf: conf ? parseInt(conf, 10) : undefined - }; + if (Math.abs(lonLat[0]) <= 180 && Math.abs(lonLat[1]) <= 90) { + return { + lonLat, + message: '', + radius: radius ? parseInt(radius, 10) : undefined, + conf: conf ? parseInt(conf, 10) : undefined + }; + } else { + return { + lonLat: undefined, + message: 'Coordinate out of Longitude/Latitude bounds', + radius: undefined, + conf: undefined + }; + } } /**