From a7551f7d4f56726a4bd7faa5a1e696dc9044370a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pierre-=C3=89tienne=20Lord?= Date: Thu, 13 May 2021 12:19:18 -0400 Subject: [PATCH] fix(map utils): conversion to latitude longitude out of bounds --- 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 + }; + } } /**