In the previous section we showed where to find the navigation data files in X-Plane 11, and where to find documentation for the file formats on the X-Plane developer website. In this section we read the waypoints from earth_fix.dat.
First thing to do is inspect the file. Grab your favorite code editor and drop the data file in. Here we show the top and bottom:
the start and end of the file are indicated with I and 99 (purple)
the format version is 1101 (yellow)
the data cycle is 1802 (green) - this is the AIRAC cycle, and if you look up an AIRAC calendar you will see this corresponds to February 1, 2018
the source is listed as Navigraph / Jeppesen (pink) - so if you were wondering where X-Plane got all this data from, here is your answer: they bought it from a data provider
there are 198,612 rows in the data file
Next we move on to loading the file with Python. We are using a Jupyter notebook and will reproduce some of the key cell blocks below.
Python and pandas don't know about this X-Plane format so we have to write our own instructions for how to parse the data. The file is loaded into a list called raw_navdata.
We loop through the data line by line. For each line, we delete the "\n" and then split the line into pieces. The meaning of each piece is indicated in the X-Plane format documentation. Then, we reconstruct the pieces into a table using geopandas. The fancy term for this table is geodataframe, which in the code I've shortened to gdf.
The length of the geodataframe is 4 less than the length of the file. This is expected because we ignored the header and footer lines. We can print the first and last 10 rows for inspection:
We are taking some liberties with our column names. The column names do not necessarily correspond to ARINC format terms.
The entire type column is set to "waypoint"
The subtype field gets set to either "terminal" or "enroute"
The icao_region column is either "ENRT" or the airport terminal area ICAO code
We ignored columns 4 and 5 in the data file
In the next section we will move on to the next file, which contains navigation aids.