Skip to content

feat(flights): follow a selected aircraft live, with a view of the ground below and a 3D model - #520

Merged
simplifaisoul merged 1 commit into
masterfrom
feat/aircraft-live-view
Nov 27, 2026
Merged

simplifaisoul merged 1 commit into
masterfrom
feat/aircraft-live-view

Conversation

@simplifaisoul

Copy link
Copy Markdown
Owner

Summary

Selecting an aircraft now takes the camera to it and follows it live. A readout card replaces the popup. Its position, altitude, speed, heading and climb rate update as the aircraft moves, alongside its route, type and registration.

As with the satellite card from #515, the card shows the ground beneath the aircraft from Esri World Imagery. A toggle switches to a 3D model of the aircraft's type.

No track line is drawn for the selected aircraft. The map shows a ring and its live marker.

Changes

Fly to and follow

  • A click on an aircraft eases the camera to it (zoom 7 to 10). The flights feed can be minutes old, so the first live fix redirects the camera to where the aircraft is now.
  • The selected aircraft gets its own ring and marker (sel-ac-ring, sel-ac-icon). It is filtered out of the flights layers so it is not drawn twice.
  • Escape, the close button or a click on empty map clears the selection.

Live position

  • New /api/aircraft/live?icao24= returns the aircraft's latest position from adsb.lol, with adsb.fi as a fallback. Neither sends CORS headers, so the server asks on the page's behalf.
  • Visitors following the same aircraft share one answer for five seconds. All outbound requests together are held to three a second, in bursts of up to six. Past that the route answers 503, and the card keeps moving the aircraft on from its last fix.
  • The card asks every ten seconds, and not while the tab is hidden. Between fixes it moves the aircraft on from its ground speed, track and climb rate (src/lib/aircraft-live.ts). A fix is moved on for at most 90 seconds and then held where that leaves it, rather than guessing further. An aircraft on the ground is not moved.
  • Card fields:
    • altitude (ft and m), speed (kt and km/h), heading, vertical rate and position
    • type, registration and squawk, with emergency codes highlighted
    • origin, destination and progress from /api/flight-route
  • Model, registration and operator still come from /api/aircraft.

View below

  • SatelliteView becomes ViewBelow, shared by both cards. For an aircraft it looks straight down from the aircraft's altitude, with its direction of travel at the top, and carries Esri's required credit.

3D model

  • src/lib/aircraft-models.ts maps an ICAO type code (A20N, B788, CRJ9, AT76, H60…) to one of 12 families: narrow-body, wide-body, four-engined, regional, rear-engined jet, turboprop, three kinds of light aircraft, helicopter, fighter and airlifter.
  • Each model is built from simple shapes, scaled to the type's published length and span. A code that is not listed falls back to a family by its pattern, or by the feed's category for a helicopter, and shows no size. An unknown aircraft is drawn as a generic airliner.
  • Only listed types show a length and span. The card labels every model as illustrative.
  • The satellite card's three.js viewer moves into a shared ModelView, and SatelliteModel now wraps it. three.js still loads the first time a model opens, and the WebGL context is released when it closes.
  • CardBits.tsx holds what both cards share: field rows, compass points and the VIEW / 3D MODEL toggle.

Testing

  • npx vitest run: 181 files, 1,839 tests passed. New tests cover:
    • reading adsb.lol and adsb.fi records into a position (fixFromReadsb)
    • dead reckoning, great-circle travel and checking a fix before using it
    • choosing a model from a type code, a code pattern or the feed's category
  • npx tsc --noEmit is clean. eslint shows no new findings in the changed files; OsirisMap.tsx has one error fewer than on master.
  • next build passes.
  • With next start, a headless browser selected an Airbus A321neo and a Boeing 737-800 over Germany, and checked:
    • the camera flight to the aircraft, the card going live and the position moving between fixes
    • Esri tiles loading with no failures
    • the 3D model opening with the type's length and span, then switching back to the view
    • only the ring and marker layers on the map, with no line layers

🤖 Generated with SIMPLIFAI

…ound below and a 3D model

Selecting an aircraft now opens a readout card in place of the popup and
eases the camera to it. The card asks /api/aircraft/live for the
aircraft's latest position every ten seconds and moves it on between
fixes from its ground speed, track and climb rate, so the marker glides
instead of jumping. No track line is drawn: the map shows a ring and the
aircraft's live marker only.

The card shows the ground beneath the aircraft from Esri World Imagery,
or a 3D model of its type built from the ICAO type code. The satellite
card's view below and model viewer become shared components (ViewBelow,
ModelView) used by both cards.
@vercel

vercel Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
osiris Ready Ready Preview Nov 27, 2026 7:16am UTC

@simplifaisoul
simplifaisoul merged commit ac02d11 into master Nov 27, 2026
3 checks passed

This branch was successfully deployed

1 active deployment
Preview – osiris — 1ee20d21 Deployed Nov 27, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant