MalcolmRobb/dump1090 — pull request #12 by ekkithump (2014-01-25 22:11:03+00:00)
Title: My modifications... I like them.

Hi,
I'd been slowly making a number of modifications to my fork of antirez's
code-base which I've now re-written and improved with a bit more thought onto
a fork of your repo.
I did rather apply them all at once though, so most of my commits squashed here
are bug-fixing / re-factoring rather than applying the different extra features in a
logical manner. Sorry it's such a big patch, that's why.

New Features:
* Map gets centred on user's runtime-specified position
* Calculation / display of range, azimuth and elevation of each aircraft.
* Azimuth / lowest angle file (for plotting e.g. with gnuplot)
* Azimuth plot(s) on map
* Adjustable polling of server
* Server remembers partial trails of aircraft
* Selection of trail display : selected/active/reapable & reaped
* Browser incrementally calculates (and shows) a guess of plane's location
based on speed/direction if updates are slow.

Rationale / description:
The azimuth file contains in one degree intervals, both maximum distance (km)
and lowest elevation. The file is updated by default every 10 minutes,
but only if there have been changes.

I've not yet tried to adjust the interactive display for range and elevation, on
this fork though I had that originally. When the sky is clear it helps spot an
approaching plane.

The javascript can pull in the azimuth plot multiple times so you can see e.g. if
there have been changes in the last hour. (any pulled in plot may be deleted)

I like to see trails, so I can see at a glance if there's a plane doing
something interesting. e.g. been put in a stack where I expected it to just
land. Sometimes I'm away and I like to see where the planes have been,
hence all the trail display options.

When viewing, I find one update every 2 to 5 seconds is normally sufficient.
If I'm reading another tab, I don't see why the browser should waste it's and
the server's CPU time updating every second. If the window loses visibility
the updates reduce to 45 seconds.

In that time, of course, the planes can move quite a way. Hence the server now
keeps a small (runtime-configurable) cache of old positions. The change to
the server code to make it remember e.g. altitude would be 1 changed #define
and 2 more lines.

This also means that if the browser has only just started then trails are still
available. To avoid wasted CPU cycles on browser & server, the browser tries
to guess a sensible number of positions, rather than the whole cache.

Guesses: My kids get really confused by planes just sitting there while another
seemingly runs into it. If a plane hasn't moved in >5 seconds, the browser starts
calculating and displays an arrow showing where the plane probably is.
I don't know if it's noise-related or just normal, but I frequently see a plane's heading
being updated but no new positions for > 30 seconds, and I'm pleasantly surprised how
accurately the guesses work out, even when the plane turns.
Maybe the guess's label should show the flight number, but so far it just gives the hexcode.