Catch when OS grid references aren't calculated
This commit is contained in:
1 parent
ad4451a757
commit
5e68959c03
1 file changed
+3
@@ -81,6 +81,9 @@ export function convertCoordinates (inLat, inLong, inFormat, outFormat, precisio
|
||||
const latlon = new geodesy.LatLonEllipsoidal(parseFloat(convLat), parseFloat(convLong));
|
||||
const osng = geodesy.OsGridRef.latLonToOsGrid(latlon);
|
||||
convLat = osng.toString();
|
||||
if (convLat === "") {
|
||||
throw "Couldn't convert co-ordinates to Ordnance Survey National Grid. Are they out of range?";
|
||||
}
|
||||
} else {
|
||||
convLat = convertSingleCoordinate(convLat.toString(), "Decimal Degrees", outFormat, precision);
|
||||
convLong = convertSingleCoordinate(convLong.toString(), "Decimal Degrees", outFormat, precision);
|
||||
|
||||
Reference in new issue
Block a user