Each Summer during our town hall week, FlightAware engineers participate in our annual Hackathon. During the Hackathon, we take a break from our normal work to play around with technology, have some fun, compete against each other, and try to hack something amazing together. It’s a great experience where we interact with other engineers throughout the organization and get to know each other a little better.
During the Hackathon of 2020 (incidentally our first remote Hackathon), I had the pleasure of being on a team with James Wilson (a web engineer), Chris Roberts (a fellow backend engineer), and Lakshmi Raman (our QA lead at the time). After throwing out a variety of ideas, we decided we wanted to try to animate multiple historical flights simultaneously, and this post will cover how we went about doing that and how that hackathon project continues to live on today.
Hack It Up
So, we decided we wanted to replay multiple historical flights simultaneously, but how were we going to do that? Thankfully, we work at FlightAware, so we have access to probably the most complete historical flight dataset one could hope for. Our first issue was that we could not easily use the existing map infrastructure at FlightAware. It’s built on OpenLayers, and while it works great for FlightAware’s current use case, it’s a very bespoke implementation and trying to incorporate multiple flight replay into FAMap in basically a day was not something we thought we could accomplish.
James suggested we use the Mapbox SDK to speed things along, and he very quickly (thanks to his years of experience on the Web team and a great example on the Mapbox site) threw together the first proof of concept (POC). The backend for that first version used our typical Tcl / Rivet stack and leveraged something called trackstream to access historical flight tracks. Trackstream itself is just a library which queries either our real-time position data store (popeye) or postgres tracks database to marshal an appropriate tracks response. That first version worked well and gave us confidence we could produce a slick presentation.
Following on James’ initial POC, we set to work on making it better. The animation needed some improvement, and we really wanted to have a scrubber on the screen, other controls, and some interface to load interesting historical flight events. I spent most of my time during the hackathon working on the animation piece. If you have not dealt with map animations before, our approach was the same as found in that Mapbox example above. We defined an animate function, and call requestAnimationFrame, passing it our animation function. The animation function figures out where all the aircraft in our dataset should be for a given animation frame. We do that by creating a virtual clock which moves forward by some increment, determined by the replay rate, then by examining our tracks dataset to filter down to the position to display at that virtual time. The function also handles adding markers for aircraft that depart during the animation window and removing markers when they arrive (incidentally the early versions didn’t do this, so you would get a big pileup of markers at airports if you were doing a replay of aircraft departing and arriving at a given airport). As part of the data ingestion process, we create a position for each flight at each virtual time increment using a simple interpolation between real positions to achieve a smooth animation. The best description of the code and approach would be hacky, but hey, it’s a hackathon!
Chris built out our scrubber functionality during the hackathon as well as fixing up all sorts of bugs we found along the way, James built out an admin interface for creating new replays, and Lakshmi made sure everything was working as we were quickly adding new code and features to the tool. The replay interface requires you to figure out the list of flights you want displayed ahead of time, and we did that aggregation separately, producing a list of flight identifiers for each event we wanted to show.
Ultimately, everything came together, and we found a few fun events to show. A couple of noteworthy ones were a replay of flights arriving at Oshkosh for AirVenture the previous Summer and a replay of a FlightAware flyout where the aircraft I was flying had an issue, and all the other planes had to fly back to pick us up. Our team wound up winning that year and we had a great time throwing our project together.
Fast Forward to Today
The hackathon project was a lot of fun, and while it demonstrated a fun way to visualize historical flight data, the project sat on the shelf for the next couple of years (as is usually the case for hackathon projects; after all, we were building things for fun, not to put into production). Following the acquisition by Collins Aerospace of FlightAware, we hosted a hackathon for Collins engineers and that got me thinking about our old hackathon project. I went looking to see if it still worked; lo and behold, I was able to pull the code up, dust it off, and go relive the glory of our 2020 hackathon project. I then went and found a recent event and created a replay for that, which I posted in our flying channel on Slack.
Apparently, some marketing people lurk in that channel too, and they noticed the replay and thought that was fun. I forgot about that little trip down memory lane shortly thereafter, but in the leadup to Hurricane Ian approaching Florida, marketing reached out to see if I could do one of these replays for flight traffic around the hurricane. Of course I said, “Sure, that sounds like fun! And you know what? I’ll see if I can incorporate weather replay (because how hard could that be) so you can see both the flights and the hurricane.”
Well, it turns out that replaying flights over a broader area wasn’t what we had in mind back in the day, and yes, figuring out how to get all the weather tiles in there and playing nice wasn’t going to take just 5 minutes. But I really wanted to be able to pull this together, so I banged away on it that evening, figuring out how to preload all the weather tiles I’d need and then show and hide them based on the virtual clock in the replay and even have that work with our scrubber. I also had to change out some the backend code because the page was timing out while trying to load flight tracks for the ~15,000 aircraft I was animating over that one-day period. So really, it was a bit of a hackathon on my own that evening, but I succeeded in producing the animation.
As a nice bonus, it turned out we had great coverage of all the hurricane hunters flying into the eye of the storm and the animation really highlighted that.
This is probably one of the less serious posts to grace the pages of FlightAware’s Angle of Attack blog, but it’s worth highlighting that this is only one example of how a fun hackathon or side project turned into something useful for the company. It’s a strong testament to the unique way that FlightAware empowers its employees to create powerful tools and software and iterate on them. I’m not alone in finding ways to find joy in the work I do – everyone at FlightAware demonstrates their passion for our chosen crafts in ways big and small, and that’s a big part of why I enjoy working here so much.