The apt.dat airport file

Last updated · how this page is sourced

Every runway, taxiway, apron, windsock and taxiway sign in FlightGear scenery comes out of one plain-text file. It is shared with X-Plane, it is 106 MB, and the copy FlightGear ships is older than most people assume.

How old

The second line of the file says so, in among a full GPL notice:

1000 Version - data cycle 2013.10, build 20131335, metadata AptXP1000,
further modified by the FlightGear team (cf. <https://sourceforge.net/…>).
Copyright © 2013, Robin A. Peel […]

Data cycle 2013.10. The airport layouts FlightGear builds scenery from are, at their base, a 2013 snapshot with FlightGear’s own changes layered on. Runways resurfaced since then, taxiways rebuilt, airports opened or closed; none of that is in it unless somebody edited it in.

Which is a reason to build your own scenery rather than an argument against it: if you know an airport has changed, you can fix it and rebuild. Updated layouts come from the X-Plane Scenery Gateway, which is where the data originates.

What is in it

Line-oriented, whitespace-separated, first field is a row code. The whole file is 2,465,648 lines describing 34,074 airports. Every count on this page comes from one pass over the file and the commands are published with the build record, so none of it has to be taken on trust:

Airport headers, counted in the shipped file.
CodeMeaningCount
1Land airport27,486
17Heliport6,004
16Seaplane base584

Worth knowing when a build reports its airport count: “34,074 airports” is mostly helipads and small strips. A one-degree square that reports 31 airports may hold three you have heard of.

Everything between one header row and the next belongs to that airport. The codes TerraGear recognises, from src/Airports/GenAirports/global.hxx:

CodesWhat they carry
100, 101, 102Land runway, water runway, helipad
110Pavement; an apron or taxiway polygon
111116The nodes that draw those polygons: plain, bezier, closing, terminating
120Linear feature; painted lines and lighting strings
130Airport boundary
10Taxiway, in the older format
14, 15Viewpoint, aircraft startup location
18, 19Light beacon, windsock
5056Communication frequencies

The node codes dominate the file; 1,149,272 plain nodes and 485,010 bezier nodes, against 33,721 runway rows. Airports are mostly the shapes of their pavement.

A real record

San Francisco, as the file has it:

1     13 1 0 KSFO San Francisco Intl
100   60.96 1 1 0.00 1 2 1 10L 37.62872250 -122.39342127 0.00 262.13 3 0 0 1 28R ...
100   60.96 1 0 0.00 1 2 1 10R 37.62527727 -122.39074787 0.00   0.00 3 0 0 1 28L ...
100   60.96 1 1 0.00 1 2 1 01R 37.60620279 -122.38114713 149.96 0.00 3 0 0 1 19L ...
100   60.96 1 1 0.00 1 2 1 01L 37.60897310 -122.38223043 149.96 0.00 3 0 0 1 19R ...
21    37.62713187 -122.38809462 2 117.90 3.00 10L PAPI-4L
21    37.62386399 -122.38605031 1 117.90 3.00 10R VASI

The header row is the code, field elevation in feet, two fields no longer used, the ICAO identifier and the name. Each 100 row is one runway described from both ends at once: width in metres, surface type, then for each end a designator, latitude, longitude, displaced threshold and overrun.

KSFO’s four runways in four rows, and the pair of crossing pairs that make its layout recognisable from the air is visible in the designators alone; 10L/28R and 10R/28L crossing 01R/19L and 01L/19R.

The 21 rows are approach lighting: a PAPI on 10L, a VASI on 10R.

How TerraGear reads it

genapts checks the version line first and refuses anything outside 1000 to 1200. Then it scans the entire file looking for airports inside your bounding box: all 34,074 of them, every time, whatever size your region is.

That sounds like the expensive part and is not. Reading all 106 MB and matching nothing takes 0.55 s. --airport=KSFO is worth using because building airports is what costs, and KSFO is one of the expensive ones.

Pass it uncompressed. $FG_ROOT/Airports holds apt.dat.gz and genapts --help says gzip is fine. It is not: the version check reads gzip, the scan that follows does not, and the run spins forever without an error. gunzip first; the full diagnosis is here.

Getting a copy

curl -L -o apt.dat.gz \
  https://gitlab.com/flightgear/fgdata/-/raw/next/Airports/apt.dat.gz
gunzip apt.dat.gz

27 MB compressed, 106 MB unpacked. If FlightGear is installed you already have it. Editing it is how you fix an airport that has changed since 2013: it is a text file, and the format above is the whole grammar you need for a runway.