feat: Enhance flight trails with historical altitude data and fix label display
- Extend PositionPoint struct to include altitude field in position history - Update position history population to store altitude with each position - Fix 3D aircraft labels to show GroundSpeed instead of undefined Speed field - Enable true 3D flight trails with proper altitude visualization - Improve trail accuracy by using historical altitude data per position Resolves trails showing flat paths and labels showing N/A for speed. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
fec2f111a1
commit
c6aab821a3
2 changed files with 15 additions and 13 deletions
|
|
@ -927,7 +927,7 @@ class SkyView {
|
||||||
update3DAircraftLabelContent(label, aircraft) {
|
update3DAircraftLabelContent(label, aircraft) {
|
||||||
const callsign = aircraft.Callsign || aircraft.Icao || 'N/A';
|
const callsign = aircraft.Callsign || aircraft.Icao || 'N/A';
|
||||||
const altitude = aircraft.Altitude ? `${Math.round(aircraft.Altitude)}ft` : '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 = `
|
label.innerHTML = `
|
||||||
<div style="font-weight: bold;">${callsign}</div>
|
<div style="font-weight: bold;">${callsign}</div>
|
||||||
|
|
@ -1084,10 +1084,10 @@ class SkyView {
|
||||||
|
|
||||||
// Convert position history to 3D world coordinates
|
// Convert position history to 3D world coordinates
|
||||||
aircraft.position_history.forEach(pos => {
|
aircraft.position_history.forEach(pos => {
|
||||||
if (pos.latitude && pos.longitude) {
|
if (pos.lat && pos.lon) {
|
||||||
const x = (pos.longitude - originLon) * 111320 * Math.cos(pos.latitude * Math.PI / 180) / 1000;
|
const x = (pos.lon - originLon) * 111320 * Math.cos(pos.lat * Math.PI / 180) / 1000;
|
||||||
const z = -(pos.latitude - originLat) * 111320 / 1000;
|
const z = -(pos.lat - originLat) * 111320 / 1000;
|
||||||
const y = (pos.altitude || 0) / 1000; // Convert feet to km
|
const y = (pos.altitude || 0) / 1000; // Use historical altitude from position history
|
||||||
points.push(new THREE.Vector3(x, y, z));
|
points.push(new THREE.Vector3(x, y, z));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -1136,10 +1136,10 @@ class SkyView {
|
||||||
|
|
||||||
// Convert position history to 3D world coordinates
|
// Convert position history to 3D world coordinates
|
||||||
aircraft.position_history.forEach(pos => {
|
aircraft.position_history.forEach(pos => {
|
||||||
if (pos.latitude && pos.longitude) {
|
if (pos.lat && pos.lon) {
|
||||||
const x = (pos.longitude - originLon) * 111320 * Math.cos(pos.latitude * Math.PI / 180) / 1000;
|
const x = (pos.lon - originLon) * 111320 * Math.cos(pos.lat * Math.PI / 180) / 1000;
|
||||||
const z = -(pos.latitude - originLat) * 111320 / 1000;
|
const z = -(pos.lat - originLat) * 111320 / 1000;
|
||||||
const y = (pos.altitude || 0) / 1000; // Convert feet to km
|
const y = (pos.altitude || 0) / 1000; // Use historical altitude from position history
|
||||||
points.push(new THREE.Vector3(x, y, z));
|
points.push(new THREE.Vector3(x, y, z));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -230,6 +230,7 @@ type PositionPoint struct {
|
||||||
Time time.Time `json:"time"` // Timestamp when position was received
|
Time time.Time `json:"time"` // Timestamp when position was received
|
||||||
Latitude float64 `json:"lat"` // Latitude in decimal degrees
|
Latitude float64 `json:"lat"` // Latitude in decimal degrees
|
||||||
Longitude float64 `json:"lon"` // Longitude 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
|
Source string `json:"source"` // Source that provided this position
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -655,6 +656,7 @@ func (m *Merger) updateHistories(state *AircraftState, aircraft *modes.Aircraft,
|
||||||
Time: timestamp,
|
Time: timestamp,
|
||||||
Latitude: aircraft.Latitude,
|
Latitude: aircraft.Latitude,
|
||||||
Longitude: aircraft.Longitude,
|
Longitude: aircraft.Longitude,
|
||||||
|
Altitude: aircraft.Altitude, // Include altitude in position history
|
||||||
Source: sourceID,
|
Source: sourceID,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue