Yet Another Aviation Database!? 🛩
The sooner or later when you start your own flight search, flight scraping or travel hacking project (such as my hidden city search), you’ll realize that you need accurate information about airports, their IATA codes and location. While this might sound like an easy to accomplish task you’ll probably soon enough realize that this can be a true rabbit hole. In this blog post, I’ll show you what the challenges are and how you could overcome them with a free API that I’ve created.
🥊 The challenge
Let’s assume you need a list of all 9104 IATA airports with their location to display them on a map. This task sounds easy, right?
One extremely popular database is the openflights.org database. It’s basically a compilation of two other publicly available databases. The OurAirports database and the DAFIF database which used to available to the public. The openflights.org database comes with a lot of useful information such as
Longitude and much more. If you download the extended data file from GitHub you’ll get over 12.000 air terminals, train stations, and ferry terminals, each making up a row in the comma-delimited file.
Possible downsides of using the openflights.org database
Don’t get me wrong, the openflights.org database is extremely comprehensive and impressive and also creates a solid foundation for many projects, including travelhackingtool.com, which I’d introduce you to in just a second. However, it shouldn’t be omitted that it also has some possible downsides.
Keeping a user contributed-list of thousands of airports accurate can be a very tedious task and it’s needless to say that errors will occur the sooner or later. Theses most often come from users, which had mistyped something or just haven’t been very careful. Let’s look at some examples, of what this might lead to.
Some airports like
Vilamendhoo occur multiple times in the file, making it hard to choose, which one is the most accurate one. While one might be more likely than the other, it’s ultimately up to the application developer to decide. Which one do you want to pick?
Incomplete data and test entries
Some airports which have been entered lack an IATA or ICAO code or are all together just dummy entries.
One of the biggest problems I had encountered while using the openflights.org database is the inaccuracy of the location data. This is something I stumbled upon when searching for short flights, which might make a good fuel dump strike. The errors it self are quite easy to explain, oftentimes latitude and longitude are in the wrong order, leading to highly inaccurate results. Did you know that Boston is located in Antarctica?
All of these examples clearly show that you shouldn’t fully rely on the data provided, as it contains some serious flaws. One other problem, you’ll soon enough realize is that searching those huge CSV files in Excel or even using Python can become quite cumbersome.
Handling of .dat and .csv file within an application is tedious
You’ll soon enough realize that looking up a single airport in this huge data file can be quite cumbersome and slow, especially considering that a simple search sometimes returns multiple entries (just look at the Vilamendhoo example). Even if you import them into a database you will have an additional piece of software that could fail.
🩹 Travelhackingtool.com to the rescue
Having experienced all these frustrating parts of creating a travel (hacking) app myself, led me to create
travelhackingtool.com. It’s the only free and reliable aviation API built using awesome platforms & tools such as
PostGIS. I really wanted to take the pain out of writing travel hacking or aviation applications and give you a head start when developing your own. I, therefore, constantly aggregate publicly available information, clean it up, verify it and provide it to you through an easy to use API.
Let’s check out how easy it is to use the travelhackingtool.com API
Using my travelhackingtool.com REST API is extremely easy. I’ll walk you through the three simple steps:
Create yourself a Rapid API account
Subscribe to the Travel Hacking Tool API on Rapid API (Choose the Basic Plan to begin with) and get an API token
Consume the API in your client
Let’s say you want to look up some airport details of the airport with IATA code
MUC in python. Simply use the following snippet.
The matching response will look like this:
And what’s best is that you can rest assured that the response is accurate and up to date.
Wrapping things up
I am curious to see how you are using my free API, feel free to tell me about your latest project by dropping me an email.