diff --git a/public_html/script.js b/public_html/script.js
index 05d29b7..062bba0 100644
--- a/public_html/script.js
+++ b/public_html/script.js
@@ -399,11 +399,16 @@ function refreshTableInfo() {
'align="right">Altitude';
html += '
Speed | ';
- html += 'Distance | ';
+ }
+ html += 'Track | ';
- html += 'Msgs | ';
- html += 'Seen | ';
for (var tablep in Planes) {
var tableplane = Planes[tablep]
@@ -447,6 +452,25 @@ function refreshTableInfo() {
html += '' + tableplane.altitude + ' | ';
html += '' + tableplane.speed + ' | ';
}
+ // Add distance column to table if site coordinates are provided
+ if (SiteShow && (typeof SiteLat !== 'undefined' || typeof SiteLon !== 'undefined')) {
+ html += '';
+ if (tableplane.vPosition) {
+ var siteLatLon = new google.maps.LatLng(SiteLat, SiteLon);
+ var planeLatLon = new google.maps.LatLng(tableplane.latitude, tableplane.longitude);
+ var dist = google.maps.geometry.spherical.computeDistanceBetween (siteLatLon, planeLatLon);
+ if (Metric) {
+ dist /= 1000;
+ } else {
+ dist /= 1852;
+ }
+ dist = (Math.round((dist)*10)/10).toFixed(1);
+ html += dist;
+ } else {
+ html += '0';
+ }
+ html += ' | ';
+ }
html += '';
if (tableplane.vTrack) {
@@ -499,6 +523,8 @@ function sortTable(szTableID,iCol) {
if (typeof iCol==='undefined'){
if(iSortCol!=-1){
var iCol=iSortCol;
+ } else if (SiteShow && (typeof SiteLat !== 'undefined' || typeof SiteLon !== 'undefined')) {
+ var iCol=5;
} else {
var iCol=iDefaultSortCol;
}
|