mirror of
https://github.com/gchq/CyberChef.git
synced 2025-04-20 23:06:16 -04:00
Catch when OS grid references aren't calculated
This commit is contained in:
parent
ad4451a757
commit
5e68959c03
1 changed files with 3 additions and 0 deletions
|
@ -81,6 +81,9 @@ export function convertCoordinates (inLat, inLong, inFormat, outFormat, precisio
|
||||||
const latlon = new geodesy.LatLonEllipsoidal(parseFloat(convLat), parseFloat(convLong));
|
const latlon = new geodesy.LatLonEllipsoidal(parseFloat(convLat), parseFloat(convLong));
|
||||||
const osng = geodesy.OsGridRef.latLonToOsGrid(latlon);
|
const osng = geodesy.OsGridRef.latLonToOsGrid(latlon);
|
||||||
convLat = osng.toString();
|
convLat = osng.toString();
|
||||||
|
if (convLat === "") {
|
||||||
|
throw "Couldn't convert co-ordinates to Ordnance Survey National Grid. Are they out of range?";
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
convLat = convertSingleCoordinate(convLat.toString(), "Decimal Degrees", outFormat, precision);
|
convLat = convertSingleCoordinate(convLat.toString(), "Decimal Degrees", outFormat, precision);
|
||||||
convLong = convertSingleCoordinate(convLong.toString(), "Decimal Degrees", outFormat, precision);
|
convLong = convertSingleCoordinate(convLong.toString(), "Decimal Degrees", outFormat, precision);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue