Counting Visits to Airports: The Significance of Trip Sections

My Flight Historian is by no means the only personal flight tracking website. I could have easily tracked my flights on an existing site:

So why did I go to the trouble of writing my own flight tracking application rather than just use an existing one? My primary reason was to gain experience in a new programming language, but the reason I decided to write a flight tracker rather than any other project was that I disagreed with the way the available flight trackers count airports.

The Problem with Counting Airports

To demonstrate, I entered all of my flights during 2015 into Flightdiary, FlightMemory, and, then compared their top airports listing with my 2015 top airports in Flight Historian.

Screenshots of statistics for the same set of flights on Flight Historian, Flightdiary (now myFlightradar24), FlightMemory, and The data is replicated in the below table.

Since I took these screenshots, Flightdiary has been reanamed to myFlightradar24.

For clarity, I’ve taken the numbers of flights for each airport from the above links and placed them in a table:1

Airport Flight Historian Flight­diary Flight­Memory Open­
DAY 42 42 42 42
ORD 16 32 32 32
MCO 12 12 12 12
DFW 10 17 17 17
TUL 10 10 10 10
BWI 5 10 10 10
CLT 5 10 10 10
CMH 5 5 5 5
SEA 4 4 - -
STL 4 4 4 4
ATL 3 6 6 6

Note that the three right columns are in complete agreement with each other (other than that FlightMemory and OpenFlights only show their top ten airports). However, these are in many cases different from my FlightHistorian—I highlighted the differences.

Why are they different?

Well, the airports that are different are all airports where I’ve had layovers in 2015. In many cases, the flight count is exactly doubled. (DFW is not quite doubled, but I had some trips where it was a layover and some trips where it was a destination. It only got double-counted on the trips where it was a layover.) So the other three sites all appear to be double-counting my layover airports every time I have a layover.

Airport Visits vs. Flights Involving an Airport

Let’s say, for example, that I take a one-way trip where I fly out of Dayton (DAY), have a layover at Dallas/Fort Worth (DFW), and land in Seattle (SEA).

Map showing flights from DAY to DFW to SEA.

Map generated by Paul Bogard using the Great Circle Mapper - copyright © Karl L. Swartz

Assume these two flights were the only flights I’ve ever taken. How many times would I have been to each of these airports?

As far as I’m concerned, I would have been to each of these three airports once. Even though DFW had two flights using it on this trip, I was still only there one time for my layover.

However, all three of the flight logging sites above would say that I’ve been to DFW twice:

Effectively, what they’re all doing is counting the number of flights that involve a particular airport, rather than the number of visits to an airport. This may have been a deliberate design choice, but I find the number of times I’ve visited an airport to be the more useful of those two metrics. If we’re interested in airport visits, then layovers are being double counted.

But why would so many flight logging sites decide to count airports this way? Because counting flights with a particular airport code is much easier than figuring out what is and isn’t a layover.

What’s a Layover?

If you’ve flown a few times before, you probably understand what a layover is, but let’s try to define it explicitly.

Layover: When a traveler lands at an airport on one flight, and subsequently takes off from the same airport on another flight.

This is pretty easy for a flight log site to determine—just sort all the flights in chronological order, and look if the arrival airport of one flight is the same as the departure airport of the next.

Unfortunately, it’s not as simple as that. Let’s say I’m going to Seattle again. I land at SEA, I head into the city, and a few days later, I come back to SEA to fly home. Is that a layover? No, but by the above definition it is, so maybe we should modify it to say the flights have to be on the same day.

Layover: When a traveler lands at an airport on one flight, and on the same day takes off from the same airport on another flight.

This comparison is still pretty easy for a flight log site—sort the flights, check that the airports for two adjacent flights match, and also check that this pair of flights have the same departure date.

But there are a couple of problems with this.

First, flights that are not on the same day could still be a layover. Consider a flight landing at 11:00 p.m., with a connection to a red-eye flight that departs a few minutes after midnight. The flights are on different days, but this should still be counted as a layover.

Secondly, just because two flights share the same airport on the same day doesn’t mean that they’re a layover. Imagine that I have an out-and-back, single day trip: I fly from Dayton to Chicago in the early morning, have meetings all day, and fly home from Chicago to Dayton the same evening. Both flights are on the same day, one flight lands at Chicago while the next takes off from Chicago, but it was not a layover—I spent the whole day away from the airport.

So maybe looking at the date is wrong, and we’d do better to look at whether or not we leave the airport.

Layover: When a traveler lands at an airport, and, without leaving the airport in between, takes off from the same airport on another flight.

This is actually the definition I use on my flight log. But looking at a list of flights, departure dates, departure airports, and arrival airports, how could a flight log website know whether or not you left the airport? There’s really no way it can tell. Thus, flight log websites tend to ignore layovers completely and just count airport codes, with the consequence that all the layovers get their airport counted twice.

Enter the Trip Section

When I wrote my Flight Historian, I quickly realized that it wasn’t going to be able to figure out whether or not I left the airport between flights. I decided that I had to find a way to tell it, and I accomplished that with what I called trip sections.

I had already planned to group flights into trips, so that I could link to a specific trip and show all the flights involved with it. This functionality is not unique; OpenFlights also allows flights to be assigned to trips, for example.

But I took it further, and broke the trips into sections. Each section of the trip represented a complete, one-way journey from an origin to a destination, with as many layovers as necessary in between. Thus, using our final definition of layover, I needed to start a new trip section every time that I left an airport between two flights.

Every flight in my flight log records what trip it belongs to, and what section of that trip it falls in. The trip section is simply a number; I start with Section 1, and increment the number as high as it needs to go to describe my whole trip. (Right now, I have trips with only a single section, and trips with as many as six sections!) From there, all my software has to do is check whether two consecutive flights are in the same trip and same section number; if they are, then there’s a layover between them and their mutual airport should only be counted one time.

Parting Words

Of course, my goals with Flight Historian were not necessarily the same as any other flight log’s goals. It could be that they felt that counting flights involving each airport was more useful than counting visits to a particular airport, or it could be that they’d rather not make their users take the extra step of splitting their flights into trips and their trips into sections. All of these are valid.

But if any developer prefers the way I count airports, I’d recommend they consider implementing something similar to my trip sections!

  1. For the sake of image size, not all of the table’s numbers are in the screenshot; however, all of the airport counts in the table are available on their respective sites. ↩︎