From a99d5848df28cee3773e276ddf42b86af9259149 Mon Sep 17 00:00:00 2001 From: NightScript <18664762+NightScript370@users.noreply.github.com> Date: Mon, 29 Jul 2024 17:13:41 -0400 Subject: [PATCH] Implement altitude accuracy --- assets/js/location.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/assets/js/location.js b/assets/js/location.js index 7d83354..45f11e6 100644 --- a/assets/js/location.js +++ b/assets/js/location.js @@ -157,8 +157,10 @@ async function updateList(event) { /** @type {Omit & { coords: Partial}} */ const params = { timestamp: new Date().getTime(), coords: { latitude: lat, longitude: lng } } - if (elements.manual.elevationInput.value) + if (elements.manual.elevationInput.value) { params.coords.altitude = parseFloat(elements.manual.elevationInput.value); + params.coords.altitudeAccuracy = true + } await setLatLong(params, !elements.manual.timezoneSelect.value); openCalendarWithLocationInfo(); @@ -420,7 +422,7 @@ async function setLatLong (position, manual=false) { geoLocation.lat = position.coords.latitude geoLocation.long = position.coords.longitude - if ('altitude' in position.coords && position.coords.altitude !== null) { + if ('altitude' in position.coords && position.coords.altitude !== null && 'altitudeAccuracy' in position.coords && position.coords.altitudeAccuracy) { geoLocation.elevation = position.coords.altitude } else { geoLocation.elevation = await getAverageElevation(position.coords.latitude, position.coords.longitude);