</p>
<div id="posavail" style="display:none">
<table>
-<tr><td>Latitude:</td><td id="posLat">...</td></tr>
-<tr><td>Longitude:</td><td id="posLong">...</td></tr>
-<tr><td>Accuracy:</td><td id="posAcc">...</td></tr>
-<tr><td>Altitude:</td><td id="posAlt">...</td></tr>
-<tr><td>Alt. Accuracy:</td><td id="posAltAcc">...</td></tr>
-<tr><td>Heading:</td><td id="posHead">...</td></tr>
-<tr><td>Speed:</td><td id="posSpd">...</td></tr>
-<tr><td>Timestamp:</td><td id="posTime">...</td></tr>
+<tr><td>Latitude:</td><td id="posLat" class="posVal">...</td></tr>
+<tr><td>Longitude:</td><td id="posLong" class="posVal">...</td></tr>
+<tr><td>Accuracy:</td><td id="posAcc" class="posVal">...</td></tr>
+<tr><td>Altitude:</td><td id="posAlt" class="posVal">...</td></tr>
+<tr><td>Alt. Accuracy:</td><td id="posAltAcc" class="posVal">...</td></tr>
+<tr><td>Heading:</td><td id="posHead" class="posVal">...</td></tr>
+<tr><td>Speed:</td><td id="posSpd" class="posVal">...</td></tr>
+<tr><td>Timestamp:</td><td id="posTime" class="posVal">...</td></tr>
</table>
+<p class="note">
+All coordinates use the WGS84 coordinate system.
+</p>
</div>
</section>
</p>
<div id="gravavail" style="display:none">
<table>
+<tr><td>Total:</td><td id="gravTotal" class="gravVal">...</td></tr>
<tr><td>X:</td><td id="gravX" class="gravVal">...</td></tr>
<tr><td>Y:</td><td id="gravY" class="gravVal">...</td></tr>
<tr><td>Z:</td><td id="gravZ" class="gravVal">...</td></tr>
document.getElementById("posavail").style.display = "block";
this.watchID = navigator.geolocation.watchPosition(
function(position) {
- document.getElementById("posLat").textContent = position.coords.latitude;
- document.getElementById("posLong").textContent = position.coords.longitude;
- document.getElementById("posAlt").textContent = position.coords.altitude;
- document.getElementById("posAcc").textContent = position.coords.accuracy;
- document.getElementById("posAltAcc").textContent = position.coords.altitudeAccuracy;
- document.getElementById("posHead").textContent = position.coords.heading || "---";
- document.getElementById("posSpd").textContent = position.coords.speed || "---";
+ document.getElementById("posLat").textContent =
+ position.coords.latitude + "°";
+ document.getElementById("posLong").textContent =
+ position.coords.longitude + "°";
+ document.getElementById("posAlt").textContent =
+ position.coords.altitude.toFixed(0) + " m";
+ document.getElementById("posAcc").textContent =
+ position.coords.accuracy.toFixed(0) + " m";
+ document.getElementById("posAltAcc").textContent =
+ position.coords.altitudeAccuracy.toFixed(0) + " m";
+ document.getElementById("posHead").textContent =
+ position.coords.heading ? position.coords.heading.toFixed(0) + "°" : "---";
+ document.getElementById("posSpd").textContent =
+ position.coords.speed ? position.coords.speed.toFixed(1) + " m/s" : "---";
var locTime = new Date(position.timestamp);
document.getElementById("posTime").textContent = locTime.toISOString();
},
document.getElementById("gravAlpha").textContent = "...";
document.getElementById("gravBeta").textContent = "...";
document.getElementById("gravGamma").textContent = "...";
+ document.getElementById("gravTotal").textContent = "...";
document.getElementById("gravX").textContent = "...";
document.getElementById("gravY").textContent = "...";
document.getElementById("gravZ").textContent = "...";
document.getElementById("gravGamma").textContent = orientData.gamma.toFixed(1) + "°";
},
motionEvent: function(event) {
+ var gravTotal =
+ Math.sqrt(Math.pow(event.accelerationIncludingGravity.x, 2) +
+ Math.pow(event.accelerationIncludingGravity.y, 2) +
+ Math.pow(event.accelerationIncludingGravity.z, 2));
+ document.getElementById("gravTotal").textContent = gravTotal.toFixed(2) + " m/s²";
document.getElementById("gravX").textContent = event.accelerationIncludingGravity.x.toFixed(2) + " m/s²";
document.getElementById("gravY").textContent = event.accelerationIncludingGravity.y.toFixed(2) + " m/s²";
document.getElementById("gravZ").textContent = event.accelerationIncludingGravity.z.toFixed(2) + " m/s²";