Have to agree with toverfield here. I tested the (manual) wget command on my Pi and it did indeed download a populated json file. Additionally, the wget is the exact method that jprochazka’s script uses to fetch the json file.
An incorrect id will cause an empty json file to be returned. That’s one possibility. Another is that he did not put the whole command on one line. The comments I copied/pasted from the latest dump1090 script.js may be a bit confusing since they have a line break and the full wget command is split across two lines.
Copy-paste wget command from below. After pasting in terminal, replace XXXX by your ID from heywhatsthat site.
sudo wget -O /usr/share/dump1090-mutability/html/upintheair.json 'http://www.heywhatsthat.com/api/upintheair.json?id=XXXX&refraction=0.25&alts=3048,9144'
# add ,6096 at the end if you want 20,000 feet ring also.
# add ,12192 at the end if you want 40,000 feet ring also.
EDIT: Updated wget command to writte the json data to a file directly in the required place and required name (i.e. in the folder /usr/share/dump1090-mutability/html with name upintheair.json). I have missed out that part of command. Thanks to @phillx19090 for giving a complete command in his post below.
@obj
The default value of refraction on heywhatsthat site is 0.14, but you have specified refraction=0.25. I am not sure, but feel this is due to slight difference in propagation parameters of Light waves & Micro waves, and will cover for difference between optical and radio horizons (For microwaves, the radio horizon is farther than optical horizon by say 50 nautical miles or so).
I’m having trouble getting this working. I followed wnypoker’s instructions to the letter. In ‘vi’ I used ‘:set list’ to make sure I didn’t have any extraneous characters in the file. It looks good. Now I see this about the upintheair.json. Do I need that as well as wnypoker’s instructions? I did ‘wget’ my json file as described below. Do I need to update/rebuild dump1090-muta to get this to work?
in /usr/share/dump1090-mutability/html I have added the files
12000.js (my javascript file with coords as per wnypoker
modified script.js
modified gmap.html
upintheair.json downloaded with wget from mutability (this produced a populated file)
I’m just getting the endless spinner.
Edit: Nevermind. Got it working. Thanks to all. This is great!
It wasn’t working when I followed wnypoker’s instructions (sorry). Next I created the upintheair.json and it worked. I got confused reading this thread. Probably just me being dense.
wnypoker’s instructions came first, and were ok.
Shortly after that, obj included necessary coding in script.js and also included a script to pull the json file automatically when user enter their heywhatsthat ID, but the heywhtsthat site had restrictions to automatic pull of the json data. Then obj added a comment in the script.js file, as well as posted in this thread, advising users to pull the json data manually by wget command.
obj’s mods have made wnypoker’s steps unnecessary.
Just to be clear, this isn’t really something that heywhatsthat is limiting, it is a general browser security restriction on javascript that forbids cross-origin resource sharing, i.e. a script cannot request data from a different domain unless it’s explicitly permitted by the datasource.
I’ve been experimenting with live plotting the maximum range within the normal dump1090 Google map. In the image below, the red and blue polygons are the 10,000 ft and 30,000 ft predicted polygons from HeyWhatsThat.com.
The green polygon is continuously updated as new positions come in showing the maximum range actually achieved in the current session at any altitude. Actually the polygon is saved in browser Local Storage, so it will survive between web sessions and you can keep building it up for as long as you like. It’s quite interesting to reset this and then watch as aircraft move and ‘push’ the polygon larger. The map shown here was after about 6 hours of collecting data for the range polygon.
It follows the shape of the predicted 30,000 ft contour fairly well. I’m not sure if the dead area south west of San Antonio is because I can’t see it, or because it’s just not an area where flights normally track. I ought to plot the 40,000 ft contour instead I think.