Fixed E/W and altitude conversionFixed comment spelling error
parent
c14553940e
commit
c10ee9e061
|
@ -11,7 +11,7 @@ if (!navigator.geolocation) $('#no-gps').show()
|
||||||
// Start tracking
|
// Start tracking
|
||||||
else navigator.geolocation.watchPosition(
|
else navigator.geolocation.watchPosition(
|
||||||
|
|
||||||
// Got location callback
|
// Got location callbackw
|
||||||
function(pos) {
|
function(pos) {
|
||||||
let lat = pos.coords.latitude.toFixed(4)
|
let lat = pos.coords.latitude.toFixed(4)
|
||||||
let lon = pos.coords.longitude.toFixed(4)
|
let lon = pos.coords.longitude.toFixed(4)
|
||||||
|
@ -21,16 +21,17 @@ else navigator.geolocation.watchPosition(
|
||||||
)
|
)
|
||||||
$('#lon').text(
|
$('#lon').text(
|
||||||
(lon.substring(0,1)=='-')? // Negative values are East
|
(lon.substring(0,1)=='-')? // Negative values are East
|
||||||
lon.substring(1)+' E' : lon+' W'
|
lon.substring(1)+' W' : lon+' E'
|
||||||
)
|
)
|
||||||
|
|
||||||
// Get altitude
|
// Get altitude
|
||||||
if (pos.coords.altitude)
|
if (pos.coords.altitude) {
|
||||||
$('#alt').show().text(
|
$('#alt').show().text(
|
||||||
(metric)? // Convert to feet if needed
|
(metric)? // Convert to feet if needed
|
||||||
pos.coords.altitude.toFixed(1)+' m':
|
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()
|
else $('#alt').hide()
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue