Parsing Pi Aware' aircraft.json File Using Python

I currently wring some Python code to parse the data found in the aircraft.json file from my Raspberry Pi. I’m also working on documenting the information found in the file. Using Copilot, reading articles online, and looking at net_io.c file from the dump1090 github I’ve been able to cobble this together. For the most part I believe this info is correct, but I’d like some feedback on the accuracy.

now - The time at which the data was collected, represented as Unix epoch time (seconds since January 1, 1970, 00:00:00 UTC).
aircraft - An array of objects, with each object representing data for a single aircraft.
hex - A unique identifier for the aircraft, typically its Mode S transponder code in hexadecimal format.
flight - The flight number or identifier assigned to the aircraft.
alt_baro - The aircraft’s altitude measured by its barometric altimeter, typically in feet.
alt_geom - The aircraft’s geometric altitude, calculated based on its position relative to the Earth’s surface, typically in feet.
gs - The speed of an aircraft relative to the ground, typically in knots.
track - The aircraft’s track, the direction it is moving in degrees, measured clockwise from true north.
geom_rate - Measures the rate of change in geometric altitude, which is the actual altitude above mean sea level
baro_rate - The rate of change of the aircraft’s barometric altitude, typically in feet per minute, indicating ascent or descent.
geom_rate - The rate of change of the aircraft’s geometric altitude, typically in feet per minute, indicating ascent or descent.
squawk - The transponder code set by the pilot, typically a four-digit octal code used for identification and communication with air traffic control.
emergency - Indicates any emergency situation the aircraft may be experiencing. Depending on the issue the squawk code reported could be 7500 (hijack),7600 (radio failure) or 7700 (technical, mechanical or medical), If there is no emergency this is set to none. Depending on the squawk reported, Possible values are: “general”,“minfuel”, “nordo”, “unlawful” and “downed”
category - This is the aircraft’s type catagory. Examples include “A1”, “A2”, “A3”, “A5”, “A6”.
nav_qnh - The altimeter setting, or barometric pressure, used by the aircraft’s navigation system, typically in hectopascals (hPa).
nav_altitude_mcp - The altitude set on the aircraft’s Mode Control Panel (MCP), the interface used by pilots to control the autopilot, typically in feet.
nav_heading - The heading set on the aircraft’s MCP for the autopilot to follow, typically in degrees.
lat - The aircraft’s latitude, its position north or south of the equator, measured in decimal degrees.
lon - The aircraft’s longitude, its position east or west of the prime meridian, measured in decimal degrees.
nic - Navigation Integrity Category (NIC), a measure of the accuracy and reliability of the aircraft’s navigation system.
rc - The aircraft’s reception quality, likely indicating the strength of the signal received by the ADS-B receiver.
seen_pos - The time in seconds since the aircraft’s position was last updated.
version - The version of the ADS-B message format being used by the aircraft.
nic_baro - Navigation Integrity Category for barometric altitude data, a measure of the accuracy of the barometric altitude information.
nac_p - Navigation Accuracy Category for position data, a measure of the accuracy of the aircraft’s position.
nac_v - Navigation Accuracy Category for velocity data, a measure of the accuracy of the aircraft’s speed and direction.
sil - Source Integrity Level (SIL), a measure of the overall reliability and trustworthiness of the ADS-B data from the aircraft.
sil_type - The type of SIL being used, which could be “perhour”, “persample”, or “unknown”.
gva - Geometric Vertical Accuracy, a measure of the accuracy of the geometric altitude data.
sda - System Design Assurance, a measure of the level of confidence in the design and performance of the ADS-B system on the aircraft.
mlat - Multilateration (MLAT) data, used to determine the aircraft’s position when it is not broadcasting its own position.
tisb - Traffic Information Service – Broadcast (TIS-B) data, providing information about other aircraft in the vicinity, broadcast by ground stations.
messages - The number of ADS-B messages received from the aircraft.
seen - The time in seconds since the last ADS-B message was received from the aircraft.
rssi - Received Signal Strength Indicator (RSSI), a measure of the strength of the ADS-B signal received from the aircraft.
nav_modes - Defines the navigation modes currently active on the aircraft, such as “althold”,“autopilot”, “vnav”, “lnav”, “tcas”, and “approach”.

I’m not quite sure of the data for category. I had some information that suggests that ‘A1’, ‘A2’ and etc., are subcategories that describe a description of what I’ve seen as Category A which describes small civil aircraft. I haven’t been able to locate the documentation I found previously that contained the info.

I am plaining to make the code available on GitHub soon. I’m able to successfully use retrieve and print out the data. If you’re familiar with Python I’m using the requests library to retrieve the data and I’m using pandas to access the data.

Thanks for any feedback in advance.

readsb is a fork of dump1090-fa, ignore the extra fields:
https://github.com/wiedehopf/readsb/blob/dev/README-json.md

category: emitter category to identify particular aircraft or vehicle classes (values A0 - D7) (2.2.3.2.5.2)

Guess i should add a reference to the categories:
https://github.com/wiedehopf/tar1090/blob/master/html/formatter.js#L24

Really i should just link dump1090-fa readme i guess:
https://github.com/flightaware/dump1090/blob/master/README-json.md

But obviously i’m more familiar with the fork :slight_smile:

1 Like

I found the piaware README-json.md at dump1090/README-json.md at master · flightaware/dump1090 (github.com)

Thanks for pointing out the formatter file This validates what I was thinking. I had ran across this:

Category Subcategory Description Examples


A A00-A09 Small general aviation aircraft
A1 Small turbine-engine aircraft Light business jets, commuter aircraft
A2 Small piston-engine aircraft Cessna 172
A3 Small turbine-engine helicopters Light helicopters (training, transport)
A4 Small piston-engine helicopters Robinson R22, R44
B **B00-B09 ** Larger general aviation aircraft, small jets
B00 Small propeller-driven aircraft
B01 Small jets Business jets
B02-B09 Various larger general aviation aircraft
C *C00-C09 Regional jets and turboprops
C00 Smaller regional turboprops Bombardier Dash 8
C01 Larger regional turboprops
C02 Regional jets Embraer ERJ-145
C03-C09 Various regional aircraft
D D00-D09 Narrow-body airliners
D00 Smaller narrow-body airliners
D01 Medium-sized narrow-body airliners
D02 Larger narrow-body airliners Boeing 737, Airbus A320
D03-D09 Various narrow-body airliners
E E00-E09 Wide-body airliners
E00 Smallest wide-body airliners
E01 Medium-sized wide-body airliners
E02 Larger wide-body airliners Boeing 777, Airbus A330
E03-E09 Various wide-body airliners

let aircraftCategories = {
‘A0’: ‘Unspecified powered aircraft’,
‘A1’: Light (< 15${NNBSP}500${NBSP}lb),
‘A2’: Small (15${NNBSP}500 to 75${NNBSP}000${NBSP}lb),
‘A3’: Large (75${NNBSP}000 to 300${NNBSP}000${NBSP}lb),
‘A4’: ‘High Vortex Large(aircraft such as B-757)’,
‘A5’: Heavy (> 300${NNBSP}000${NBSP}lb),
‘A6’: High Performance (> 5${NBSP}g acceleration and > 400${NBSP}kt),
‘A7’: ‘Rotorcraft’,
‘B0’: ‘Unspecified unpowered aircraft or UAV or spacecraft’,
‘B1’: ‘Glider/sailplane’,
‘B2’: ‘Lighter-than-Air’,
‘B3’: ‘Parachutist/Skydiver’,
‘B4’: ‘Ultralight/hang-glider/paraglider’,
‘B6’: ‘Unmanned Aerial Vehicle’,
‘B7’: ‘Space/Trans-atmospheric vehicle’,
‘C0’: ‘Unspecified ground installation or vehicle’,
‘C1’: Surface Vehicle ${ENDASH} Emergency Vehicle,
‘C2’: Surface Vehicle ${ENDASH} Service Vehicle,
‘C3’: ‘Fixed Ground or Tethered Obstruction’
};

The java code here talks about the weight criteria I had seen.

Thanks for the info!

A nit, you defined geom_rate twice.

Thanks for pointing that out.

So I’m making progress with the python code. I can retrieve the aircraft.json file and written a function that will retrieve selected keys from the aircraft.json file. I’m going to set up some “views” that display specific information next.

For example, I have my columns in PiAware to show ICAO,Ident, Heading, Altitude,Speed, Distance Latitude, Longitude. Another would be, ICAO, Ident, Messages and Data Source.

Does anyone have some different column configuration? Thought I start off with some easy “views” to setup up first.

Another view that I’m thinking about is an aircraft view that includes some of the the info such as nav_modes, ADS-B version and accuracy info. This would be pulled from the aircraft.json data.

I’m still planning on putting this on Github, but would like to have several “views” already defined. One thing that I would like to have in one of the views is the distance from my receiver. I’ve found some code to calculate the distance based on the latitude and longitude of the aircraft and my pi.

Thanks for the feedback in advance.

Here is a screen shot if anyone is interested.

As requested, my PiAware column configuration is as follows:

Ident, Registration, Aircraft Type, Squawk, Altitude (ft), Distance (mi), Data Source

I just noticed the screenshot shows traffic in England. I mess around with another tracking system and like to see that is flying around. It’s more fun than looking at my local data. Some days I’ll see a Spitfire or some other World War II aircraft and current military aircraft. Occasionally I’ll see some vintage aircraft, and a little bit of military stuff locally. On occasion I’ll see the NASA T-38s but not very often.

Yeah, that’s my dot in the middle. We’re about 15 miles from RAF Coningsby (Typhoons, plus the Lancaster, Dakota, Spitfires and Hurricanes of the Battle of Britain Memorial Flight), and the same from Holbeach Air Weapons Range which gets used by F-15’s and F-35’s from RAF Lakenheath as well as the Typhoons, then there’s a large military training area plus air-to-air refuelling area out over the North Sea so I also pick up traffic using those. We also get regular flyovers from KC-135 tankers heading into and out of RAF Mildenhall. I tend to run FA as my local tracker to see what’s going overhead (we’re underneath one of the main east-west airways to Europe and beyond, and I like all the extra flight info that’s available on click-through), but also feed into both ADS-B Exchange which I use as my global tracker to keep an eye on what’s going on elsewhere around the UK, and Radar360 which I use as my military tracker. Unfortunately the aforementioned F-15’s and F-35’s use Mode A most of the time so don’t get picked up by any of the trackers, but the chap who runs 360Radar is working on a solution to that.

1 Like

I’ve uploaded the Python code to my PyDump1090fa repository on Github.