Friday, November 17, 2017


MyFlightbook's airport data comes from a variety of sources (i.e., "free"), and include codes that can be FAA (3-letter, doesn't generally use the leading "K"), IATA (3-letter, used for airline travel), and ICAO (4-letter).  I don't actually bother storing which kind of code it is, since it's generally obvious from context.

So a given airport can actually be in the database up to 3 times (though it’s pretty rare for that to actually be the case.  Some examples:
  • Kahului, Maui is "OGG" (FAA/IATA) or "PHOG" (ICAO)
  • Frankfurt, Germany, is "FRA" (IATA) or "EDDF" (ICAO)
  • Owyhee Airport (in Oregon) is "10U" (FAA), but (to my knowledge) has no official IATA or ICAO code.
In the US, most airports in the continental US have both ICAO and FAA identifiers, and most of the time, the ICAO is the FAA with a "K" prefix.  E.g., San Francisco International is "SFO" (IATA) and "KSFO" (ICAO).  But it's very often unclear whether a given airport follows this convention.*

For this reason, I treat the leading "K" as optional on any 3-character code. So, if you type “Kxxx” and I don’t have Kxxx but I do have xxx, I’ll match to that (so that “K10U” for the Owyhee example above, or KOGG for Maui, neither of which technically exist, will still work).  Or, conversely, if you type “yyy” and I don’t have yyy but do have kyyy, then I’ll match to that.  Note that this allows ICAO and FAA/IATA codes to co-exist pretty well, which is especially nice since there are some international airports that, but for the initial ICAO character, would match some small airport in Alabama. Indeed, one such example (of many) is Newtonards airport (EGAD, just outside of Belfast) and Northeast Alabama Regional (GAD).

When I autodetect to find the nearest location, I do the following:
  • Look up the closest airports to your position, sorted by that position rounded (slightly – two decimal places of nm) to try to coalesce small differences in distance.  For example, the closest airport may in the database twice with two slightly different coordinates (usually due to coming from two sources that use differing numbers of significant digits).  Note, though, that if the two sets of coordinates for the airport are further apart than the rounding will catch, then "nearest" may differ depending on whether you are on one side of the airport or the other.
  • If multiple airports tie for “closest”, airports can be further disambiguated by a “preferred” flag.  So, for example, Dallas/Ft. Worth is DFW/KDFW, and the “K” version is marked as preferred, so it should be picking that up.
  • Absent a “preferred” flag, I should bias towards the longer identifier (i.e., choose ICAO over FAA or IATA), but this is not implemented today.
A few other useful tidbits that you might want to know about airports:
  • As a logbook (rather than a flight planner), I try to keep old airports around as long as possible, often long after they have either closed or been assigned a new identifier.  
  • For the same reason, there is a strong bias towards airports over navaids, even though navaids are in the database.  But you can reverse the bias with a "@" prefix.  E.g., "BOS" is Boston Logan Airport, but "@BOS" is the Boston VOR.
  • You can add your own airports or navaids to the database.
  • You can also make up ad-hoc latitude/longitude waypoints. Use the form @xxxxxNyyyyyW to specify a latitude/longitude.  E.g., @38.8894N77.0353W is the Washington Monument.  (Obviously, change "N" to "S" or "W" to "E" as needed).  If you use one of the mobile apps, you can press-and-hold the Append-Nearest button (next to the Route field) to append your current location as such a waypoint.

*The latest download of FAA data has nearly 20,000 airports, but only a little more than 2,500 of them appear to have ICAO codes.  So that means more than 85% of US airports do NOT actually follow the Kxxx convention.

1 comment:

  1. Great article! Now I know why I see both three and four letter identifiers in my logbook!