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’ve entered all of my 2015 flights into Flightdiary, FlightMemory, and OpenFlights.org, then compared their top airports listing with my 2015 top airports in FlightHistorian. (Thanks to Amy for helping with the data entry.)

Site Comparision

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

Comparison of Year 2015 Flights

Airport Code Paul Bogard’s Flight Historian Flightdiary FlightMemory OpenFlights.org
Dayton DAY 42 42 42 42
Chicago (O’Hare) ORD 16 32 32 32
Orlando (International) MCO 12 12 12 12
Dallas/Fort Worth DFW 10 17 17 17
Tulsa TUL 10 10 10 10
Baltimore BWI 5 10 10 10
Charlotte CLT 5 10 10 10
Columbus, OH CMH 5 5 5 5
Seattle/Tacoma SEA 4 4
St. Louis STL 4 4 4 4
Atlanta ATL 3 6 6 6

For the sake of image size, not all of the above numbers are not in the screenshot; however, all of the airport counts in this table are available on their respective sites.

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 in bold red text.

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.) 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 fly out of Dayton (DAY), have a layover at Dallas/Fort Worth (DFW), and land in Seattle (SEA).

map (1)

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:

Flight 1: DAY – DFW
Flight 2: DFW – SEA

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 problems with this.

First, flights that are not on the same day could still be a layover. For example, I had a trip from Seattle to Chicago with a layover at Portland; the first flight was before midnight, and the second flight took off after midnight. The layover was less than two hours, but the flights were on different days, so this situation doesn’t fit the above definition of 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 the heck does 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!

 

Advertisements

One thought on “Counting Visits to Airports: The Significance of Trip Sections

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s