FlightAware Discussions

RPi Dump1090 tracking question and (or) idea

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)

Now is the time to say ‘the next time I do that without a backup, it will be a mistake’ :slight_smile: Been there, done that, someone stole the t-shirt.

Thanks! I’m back in the game.

Hi Marcus!!
Thank you for coding up the cool changes to dump1090/public_html.
It works very well.

I noticed that the “Distances” column is missing from the table.
I sort on that column to see the planes’ reported positions in relation to my position.
I have entered my values for my site coordinates:
CONST_CENTERLAT = 39.######;
CONST_CENTERLON = -84.#####;

I think the Distances column is missing from your script.js file.
Please add the distance column header to the table

// Add distance column header to table if site coordinates are provided
if (SiteShow && (typeof SiteLat !== ‘undefined’ || typeof SiteLon !== ‘undefined’)) {
html += '<td onclick=“setASC_DESC(‘5’);sortTable(‘tableinfo’,‘5’);” ’ +
‘align=“right”>Distance’;
}

Thank You
lancemitrex

Hi lancemitrex,

I’m not using my customisations any more. Instead, I have switched to the dump1090-mutability package which is more advanced and also has a distance column. See here for details: http://discussions.flightaware.com/ads-b-flight-tracking-f21/raspbian-ubuntu-packages-for-dump1090-mutability-available-t19619.html

The developer obj is quite active on this forum here and actively develops his code.

Regards,
Marcus

.k.
kool.
Roger that.

I think I’m coming around ‘the backside’ of dump1090-mutability…
in that…
I had downloaded that first, and installed it …
then saw your changes and did those edits…

and …
back to dump1090-mutability.

Thanks Again!
lancemitrex

Always happy to take pull requests with changes - web development is not really my thing, so if anyone wants to clean up / improve the map further, go for it…

I have no further ideas/requests right now and I’m happy with what is there:)