From c10ee9e06122b7a7624289770045bb8f996ac97a Mon Sep 17 00:00:00 2001 From: Keith Irwin Date: Thu, 4 Oct 2018 00:30:08 +0000 Subject: [PATCH] Fixed E/W and altitude conversionFixed comment spelling error --- coordinates.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/coordinates.js b/coordinates.js index a12e287..ea2a162 100755 --- a/coordinates.js +++ b/coordinates.js @@ -11,7 +11,7 @@ if (!navigator.geolocation) $('#no-gps').show() // Start tracking else navigator.geolocation.watchPosition( - // Got location callback + // Got location callbackw function(pos) { let lat = pos.coords.latitude.toFixed(4) let lon = pos.coords.longitude.toFixed(4) @@ -21,16 +21,17 @@ else navigator.geolocation.watchPosition( ) $('#lon').text( (lon.substring(0,1)=='-')? // Negative values are East - lon.substring(1)+' E' : lon+' W' + lon.substring(1)+' W' : lon+' E' ) - // Get altitude - if (pos.coords.altitude) + // Get altitude + if (pos.coords.altitude) { $('#alt').show().text( (metric)? // Convert to feet if needed pos.coords.altitude.toFixed(1)+' m': - (pos.coords.altitude*0.3048).toFixed(1)+' ft' + (pos.coords.altitude*3.28084).toFixed(1)+' ft' ) + } else $('#alt').hide() },