FlightAware Discussions

Grabbing data from tar1090


I’m thinking about adding a little LCD display to my RPI to show aircraft within view at the window. Ideally, I’d like to show alt/distances/bearing/type/callsign.

I’ve written a python script to grab the aircraft.json and the receiver.json. This gives me the receiver location and the location of the aircraft. I’ve written the script to work out the bearing and the distances to aircraft. Filtering/sorting shouldn’t be an issue.

However, I’m getting allot of aircraft without callsigns and I’m unclear how I can determine the type. I’ve applied for an ADSBExchange API but I’m reticent to grab their data and consume their resources for something that is just for me.

Anyone know a smart way of grabbing the info from tar1090?

Appreciate anyone’s thoughts…

Best wishes,


But that’s the meaning of the data sharing. You could also use the FA-API which offers some free requests for feeders as well

I’ll look at the FA-API, I think I’ve found the registrations.js which attempts to resolve the Hex to the registration… I’ll dig some more to see if I can derive type from registration. However, I think it’ll be beyond my pea like brain to call a function to .js from python…

Ah well, it’ll be a challenge during lock down…

tar1090 uses a DB for type https://github.com/wiedehopf/tar1090-db which in turn uses a DB maintained by Mictronics, see the link on the page.
It’s probably easiest to use the complete DB in a single json:

wget --compression=auto -O aircraft.json https://raw.githubusercontent.com/Mictronics/readsb-protobuf/dev/webapp/src/db/aircrafts.json

That just means you don’t have good reception usually.
Or it could be radar returns from TIS-B which don’t include a callsign.
Or it could be anonymous MLAT results from FA which also don’t have a callsign.
For these two mentioned categories you also can’t do a type lookup because you don’t have an ICAO id, just a pseud id.

Actually with tar1090 installed you can use my readsb which will actually uses the aircraft.csv.gz that tar1090 brings with it and do the DB lookup for you and put it in the json:
Or without script magic:

Be aware that DB lookup is rather new and my fork is always in flux, consider it as unstable :wink:

ADS-B appear to give me callsigns no problems in the aircraft.json, so I suspect you are right they are likely to MLAT. I don’t feed to FA but I do feed to ADSB Exchange and FR24.

I’ll work my way through the steps in your post. Many thanks for your time, appreciate your work as a whole.

This may be of interest to the OP as well (I realize it doesn’t answer the direct question however):

Just note that i’m providing two possible solutions, you don’t need to do both.
The 2nd solution is probably a bit easier to get going quick.

Cheers mate… I’m doing it as a bit of a personal project - I’ll see how far I get on… and look at those if my work is too much of a bodge!

Downloaded the aircrafts.json - that appears to be the easiest for me… I’ve got things nice and stable currently, I won’t toy with readsb quite yet… :slight_smile:

I’ve managed to extract the aircraft.csv.gz from the git-db directory - I’ve converted this to a json file. Out of interest, is this updated periodically? Is the entire file updated or is it changes only?

Why? It’s derived from the Mictronics DB, i update tar1090-db via the aircraft.json i linked.
tar1090-db is only updated when you run the tar1090 install/update script.

The aircraft.csv.gz is for my readsb, it reads the directory tar1090 keeps it automatically (or you can specify --db-file).
The reason for that is that if readsb can add type / reg info the browser doesn’t need to load (almost) the entire DB.

The json file from Mictronics appeared to have data missing when I was parsing it, but the aircraft.csv appeared to have more data. Though I accept could be entirely down to my poor coding at the beginning though :slight_smile: (my day job isn’t code related and learning python on the fly is a… journey).
I wanted to use the local copy to conserve bandwidth for those who serve the data - I know that allot of websites aren’t money making. If I’ve already got the db in some form I think I should use it. Besides, it works now! I update my tar1090 using the script frequently, so this works fine for me. Cheers for you help