## Generating GPX and KML maps with Ruby on Rails

While working on my various projects, I’ve dealt with various types of maps.

My Flight Historian plots flight data using the Great Circle Mapper tool. These maps are simple to generate from my flight data (I just have to pass it a plain text collection of airport codes) and easy to embed in my website. However, because they are static images, they can’t be easily panned, zoomed, or otherwise manipulated in the way that modern map websites and apps can.

On the other hand, my driving maps require too much detail for a single image, so I create them in Google Earth, which lets me manipulate the view as much as I need to. The driving data is a bit more complicated than my flight log data; while my flight log represents the abstract shortest distance straight line between two airports (and thus only requires specifying the airport at each end), a single drive can involve tens of thousands of coordinates that can be joined together, connect-the-dots style, to show the actual driving route taken.

Fortunately, all those coordinates are automatically generated and saved by my car’s GPS navigation unit in a file format called GPX (GPS Exchange Format), which is an XML-based file format which contains (among other things) latitude/longitudes sampled, in the case of my particular GPS, once per second.

Google Earth doesn’t use GPX format (though it can import it); instead, it uses a format called KML (Keyhole Markup Language, from back when Google Earth was Keyhole EarthViewer). KML is also an XML-based format, so conceptually it’s similarly a collection of coordinates that can all be joined together, with its own slightly different style.

But while GPX and KML can be used to represent complicated route shapes, they don’t have to be. These formats are both just as capable of taking a pair of points on the globe and drawing the shortest line between them. With that in mind, I decided to try to have Flight Historian automatically generate KML and GPX versions of my flight map, which would let me show my flight routes in Google Earth and Google Maps.

## What I Packed for PAX West 2018

Across the various PAX events I’ve been to, I’ve seen multiple people ask for suggestions for what to bring.

While everyone has different packing needs, I’ve been to 10 PAXen to date, and I also travel 2–3 weeks per month for work. Thus, I’ve got a lot of experience with packing in general, and packing for PAX in particular.

I decidedly fall into the “pack light” camp. I like to pack only what I know I’ll need, and I don’t worry about bringing things “just in case” – if I end up needing anything else, I can just buy it when I get there. That’s not a strategy that works for everybody. But even if it doesn’t, I can at least show you what I do pack, and you can use it to get ideas for your own packing list.

Here’s everything I brought to PAX West 2018:

## Airport #88/100: Fort Lauderdale (FLL)

Fort Lauderdale–Hollywood International Airport
Fort Lauderdale, Florida, United States

First visit: 16 March 2019
flighthistorian.com/airports/FLL

I’ll be honest that I wasn’t too impressed with FLL on my visit. It’s certainly possible that I was visiting at a peak season, but the airport just felt crowded in a way that I wouldn’t normally expect for an airport its size. The arrivals road loop could not handle the amount of traffic flowing through it, leading to a much longer (and much more stop-and-go) shuttle trip to the rental car center than I would have expected from the distance traveled.

It’s also one of the airports whose terminals don’t seem to be connected past the security checkpoints, which does tend to get in the way of exploring the airport before my flight. At least Terminal 3 (E/F gates) and Terminal 4 (G gates) had a connector, so since my flight departed out of 3 I was able to visit half of the airport. Though it was still under construction, the parts of Terminal 4 which were finished looked pretty nice.

## Size Comparison of NRT and DFW

This past week, I took a trip to Tokyo via Dallas/Fort Worth. Since I just completed my Tokyo–Narita terminal silhouette yesterday, I used it to create a size comparison of the two large airports I visited on my trip.

## Terminal Silhouettes: NRT

NRT.svg

I’ve had an issue with certain airports equipped to handle large quantities of large aircraft – in many cases, the jet bridges are not connected directly to the terminal structure, but instead are connected to immovable “fingers” extending from the structure. These fingers allow the aircraft to be further from the terminal, and support using multiple jet bridges for faster loading and unloading of very large aircraft.

As I discovered when I created my terminal silhouette for Vancouver, it’s not immediately clear whether the fingers should be considered part of the jet bridge (and should therefore be omitted from the drawing) or part of the terminal (and should therefore be included in the drawing).

Tokyo–Narita has similar fingers in both Terminals 1 and 2, and I debated for a while whether or not I should include them, and even started drawing them:

Ultimately, though, the terminal silhouettes are an aesthetic representation of an airport, and I liked the simplified, fingerless version of Narita better. I decided to learn from my Vancouver silhouette, and drew Narita without the fingers.

Beyond that, my other decisions were what buildings to include in the drawing at all. Satellite maps of NRT seem to show an airside connector of Terminals 2 and 3; however, airport maps (and my recollection of Terminal 2) seem to indicate that this hallway is not available for the traveling public, so I ultimately decided to exclude it. Likewise, there were a few buildings touching the southeast side of Terminal 2 which appeared to be purely administrative; since they were self-contained structures that weren’t deeply integrated with the terminal, I left them out as well.

## Airport #87/100: Tokyo–Narita (NRT)

Narita International Airport · Narita, Chiba, Japan
First visit: 10 February 2019 · flighthistorian.com/airports/NRT

This was my first trip to Japan, and as such, my first time visiting a Japanese airport. Since both my incoming and outgoing flights were on American Airlines, I only got to experience Terminal 2.

As the customs exit left me in the landside part of the terminal and I had to catch a shuttle into Tokyo anyway, I didn’t have the opportunity to explore the terminal on my way in. However, on my way home, I made sure to arrive at NRT about three hours before my flight so I’d have time to look around before departing.

The landside part of the terminal had a decent amount of shopping and I still had a couple of souvenir requests from friends to fulfill, so I headed up to the T2 shops. While I was up there, I found an observation deck.

After going through security and exit immigration, I took a walk around all of the international gates of Terminal 2.

The Platinum status I’ve earned with American Airlines grants me lounge access on international itineraries, so after I was done exploring I decided to go visit the Admirals Club.

It was a nice enough airport and I wouldn’t mind flying here again, though if I do, I might try to fly a Star Alliance or SkyTeam airline so I can check out Terminal 1.

## My “Worst” Layovers

Flying out of a smaller city like Dayton, I’m used to having flight layovers on the way to nearly everywhere I travel. While any layover is going to lengthen a trip, one of the most common complaints I hear from traveling companions is when a layover forces them to fly east to go west, or vice versa.

[All maps in this post are generated by Paul Bogard using the Great Circle Mapper – copyright © Karl L. Swartz]

I started thinking about a way to quantify how bad a layover was, and ultimately decided that it would be best to compare the sum of the (great circle) distances for each of the flights flown compared to the (great circle) distance of a direct flight from the origin to the destination:

${ratio}_{layover} = \dfrac{distance_1+distance_2+\ldots+distance_n}{distance_\text{direct}}$

This would give me a ratio of how much further I flew than I needed to, where a higher ratio would mean a worse layover. A ratio of 2 would mean I flew twice as far as I needed to, a ratio of 3 would mean three times as far, and so on. A ratio of 1 would mean a layover didn’t add any extra distance at all.