RPi Dump1090 tracking question and (or) idea

Just a thought. It would be cool if there was a way that when you look at the web interface to show the map and planes that being track it would show how many is being track, just like virtual radar does. Shows the number of planes being track in the browser.

Have you tried connecting to your pi on port 8080 as in: 192.168.0.14:8080/ ?

Yea. I do that now. But when i use Virtual Radar program. when i go threw that and pull up a web browser to view my map and see what it’s tracking it shows the number of planes being track in the browser window.

It would be nice if somewhere on this page would say how many planes are being tracked at any giving time.

I see what you mean now. Just never noticed the count in VRS or the lack in dump1090.

It would be nice to have it. Then you no how many your traffic when your looking at it.

In the script.js file that is located in the dump1090/public_html folder, a variable with the amount of aircraft shown on the table already exists. It is called “PlanesOnTable”. A few lines of javascript code to output the “PlanesOnTable” value as html is all that is needed.

Marty

That helps. So you’re saying it can be done. The question is how. I’m no pro when it comes to code. I have been in that script you’re talking about.

If you open up the script.js in the public_html subfolder where your dump1090 is, I did this:


// Refeshes the larger table of all the planes
function refreshTableInfo() {
	
	var html += '<table id="tableinfo" width="100%">';

with:


// Refeshes the larger table of all the planes
function refreshTableInfo() {
	
	var html = '<P>Total planes: ' + PlanesOnTable + '<p>';
	
	html += '<table id="tableinfo" width="100%">';

Backup the script.js in case something goes wrong!

Thanks for the code. My oddity is my plane count does not equal number lines being shown. Go figure…

Hmmm seeing that also. Doing a comparison of what’s on the map and what’s in the data.json that the script pulls from, there are a few planes that have valid locations but aren’t showing on the map…

EDIT: Looks like those that haven’t been seen for more than 60 seconds are not shown on the map thus it’s dropped hence the difference we’re seeing.

In the same function where it loops through the Planes array and processes only those aircraft that are not reapable, you could have a counter to increment for each table row that is created. Then at the end of the function, after the loop and before the innerHTML assignment, prepend the plane count to the beginning of the html variable.

Marty

I ended up updating the fetchdata()… remarked the below line with a // in front of it:


PlanesOnTable = data.length;

And added this after the squawk tests.


if (data[j].seen < 60) {
	PlanesOnTable++;
}

Hello,
I’m new to the plane tracking but I know a bit about web design and programming. So I’m in the process of making some changes and additions to the web page and if you find them useful, I can share the code. This is what I have done so far:


I can customise the labels for both clocks and also the name of my home location. Then I added a summary underneath the clocks. Here we have:

Active: number of lines in the detailed table, i.e. number of planes currently being tracked

No Pos: number of planes where no position has been established (they show white in the table and do not show on the map)

On Map: number of planes currently showing on the map. Calculated as (Active) - (No Pos)

<= 1s: number of planes for which data has been received within the last second, i.e. planes that are really fresh and active. This includes planes with or without valid position. It is counting the lines for which ‘seen’ is either 0 or 1.

I’m interested to hear if you would like to see additional fields in the summary or name them differently.

Regards and Happy New Year!
Marcus

Definitely share the code. This is cool.

Thanks

Nice work. Thats what I’m looking for. :smiley:

Thanks for the feedback! There are too many code changes to list them here individually. Therefore I have packed 4 changed files into a zip file here:
piaware

Download and unzip on your PC. The 4 files need to go into /usr/share/dump1090/public_html/ folder on your Pi. For Windows users a comfortable way is to use WinSCP:

  1. Download and install WinSCP
  2. Start a new session and enter your Pi details. You can also save the session details for future use.
  3. Now you can navigate the Pi file system easily and transfer files from and to your PC.
  4. Copy the whole /public_html/ directory from the Pi to your PC as a backup and replace the 4 files from the zip download.

If you find that it does not allow you to copy and save files into /usr/share/dump1090/public_html/ then you may have to change the owner of the folder and possibly also the files within. To do this:

a) Log into your Pi via ssh.
b) cd /usr/share/dump1090/
c) sudo chown pi public_html (this changes the owner of the directory from the default root to pi)
d) cd public_html/
e) sudo chown pi . (this changes the owner of all files from the default root to pi)
f) try the copy again from WinSCP

Now edit config.js, either from within WinSCP or the Pi command line. Edit these items:
CONST_CENTERLAT = 00.00;
CONST_CENTERLON = 00.00;
(for both the map and site settings)

SiteName = ‘My Place’;
(Your site name as shown in the ‘Distance from…’)

ClockLabelLocal = ‘My Place’;
ClockLabelGMT = ‘GMT’;
(Labels for the two clocks)

Save config.js and reload the web page. The changes should come through now.

When done, you may want to set back the owner to root on both the directory and the files:

  • cd …
  • sudo chown root public_html
  • cd public_html/
  • sudo chown root .

Enjoy!

Marcus

NICE. Thanks. My Dump1090 looks like the picture. :smiley:

Happy New Year…

Oh no! I broke my local web server. I am running dump1090-mutability. The contents of /usr/share/dump1090/public_html are different than the contents of /usr/share/dump1090-mutability/html.

Unfortunately I over wrote the contents in both directories (dump1090 and dump1090-mutability) and now I do not have the correct files in /usr/share/dump1090-mutability/html any longer.

Any idea when I can just get the correct files for dump1090-mutability?

Thanks

You can either do



$ sudo apt-get install --reinstall dump1090-mutability


which will re-install the package (preserving your config) and should fix the files.

Or manually grab a copy of the files you need from here: github.com/mutability/dump1090/ … ublic_html (use the “raw” view, then save-as)