diff --git a/assets/static/js/app.js b/assets/static/js/app.js index 246d905..8134dd2 100644 --- a/assets/static/js/app.js +++ b/assets/static/js/app.js @@ -927,7 +927,7 @@ class SkyView { update3DAircraftLabelContent(label, aircraft) { const callsign = aircraft.Callsign || aircraft.Icao || 'N/A'; const altitude = aircraft.Altitude ? `${Math.round(aircraft.Altitude)}ft` : 'N/A'; - const speed = aircraft.Speed ? `${Math.round(aircraft.Speed)}kts` : 'N/A'; + const speed = aircraft.GroundSpeed ? `${Math.round(aircraft.GroundSpeed)}kts` : 'N/A'; label.innerHTML = `
${callsign}
@@ -1084,10 +1084,10 @@ class SkyView { // Convert position history to 3D world coordinates aircraft.position_history.forEach(pos => { - if (pos.latitude && pos.longitude) { - const x = (pos.longitude - originLon) * 111320 * Math.cos(pos.latitude * Math.PI / 180) / 1000; - const z = -(pos.latitude - originLat) * 111320 / 1000; - const y = (pos.altitude || 0) / 1000; // Convert feet to km + if (pos.lat && pos.lon) { + const x = (pos.lon - originLon) * 111320 * Math.cos(pos.lat * Math.PI / 180) / 1000; + const z = -(pos.lat - originLat) * 111320 / 1000; + const y = (pos.altitude || 0) / 1000; // Use historical altitude from position history points.push(new THREE.Vector3(x, y, z)); } }); @@ -1136,10 +1136,10 @@ class SkyView { // Convert position history to 3D world coordinates aircraft.position_history.forEach(pos => { - if (pos.latitude && pos.longitude) { - const x = (pos.longitude - originLon) * 111320 * Math.cos(pos.latitude * Math.PI / 180) / 1000; - const z = -(pos.latitude - originLat) * 111320 / 1000; - const y = (pos.altitude || 0) / 1000; // Convert feet to km + if (pos.lat && pos.lon) { + const x = (pos.lon - originLon) * 111320 * Math.cos(pos.lat * Math.PI / 180) / 1000; + const z = -(pos.lat - originLat) * 111320 / 1000; + const y = (pos.altitude || 0) / 1000; // Use historical altitude from position history points.push(new THREE.Vector3(x, y, z)); } }); diff --git a/internal/merger/merger.go b/internal/merger/merger.go index 0d907ce..f2dfb07 100644 --- a/internal/merger/merger.go +++ b/internal/merger/merger.go @@ -227,10 +227,11 @@ type SourceData struct { // PositionPoint represents a timestamped position update in aircraft history. // Used to build position trails for visualization and track analysis. type PositionPoint struct { - Time time.Time `json:"time"` // Timestamp when position was received - Latitude float64 `json:"lat"` // Latitude in decimal degrees - Longitude float64 `json:"lon"` // Longitude in decimal degrees - Source string `json:"source"` // Source that provided this position + Time time.Time `json:"time"` // Timestamp when position was received + Latitude float64 `json:"lat"` // Latitude in decimal degrees + Longitude float64 `json:"lon"` // Longitude in decimal degrees + Altitude int `json:"altitude"` // Altitude in feet (0 if unknown) + Source string `json:"source"` // Source that provided this position } // SignalPoint represents a timestamped signal strength measurement. @@ -655,6 +656,7 @@ func (m *Merger) updateHistories(state *AircraftState, aircraft *modes.Aircraft, Time: timestamp, Latitude: aircraft.Latitude, Longitude: aircraft.Longitude, + Altitude: aircraft.Altitude, // Include altitude in position history Source: sourceID, }) }