Skip to content

Commit

Permalink
fix(map utils): conversion to latitude longitude out of bounds (#858)
Browse files Browse the repository at this point in the history
Co-authored-by: Pierre-Étienne Lord <[email protected]>
  • Loading branch information
pelord and Pierre-Étienne Lord authored May 17, 2021
1 parent 7ea9b3d commit 6a5a211
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions packages/geo/src/lib/map/shared/map.utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
};
}
}

/**
Expand Down

0 comments on commit 6a5a211

Please sign in to comment.