The sooner or later, when you start your own flight search, flight scraping or travel hacking project, 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 soon 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 our free API.
Let’s assume you need a list of all 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 IATA code
, ICAO code
, Latitude
, 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.
|
|
Don’t get me wrong, the openflights.org database is extremely comprehensive and impressive and also creates a solid foundation for many projects, including the travelhackingtool.com. 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.
|
|
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. 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.
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 our Vilamendhoo example). Even if you import them into a database you will have an additional piece of software that could fail.
Having experienced all these frustrating parts of creating a travel app myself, led me to create travelhackingtool.com. It’s the only free and reliable aviation API. We wanted to take the pain out of writing travel hacking or aviation applications and give you a head start when developing your own. We, therefore, constantly aggregate publicly available information, clean it up, verify it and provide it to you through an easy to use API.
Using our travelhackingtool.com REST API is extremely easy. I’ll walk you through the three simple steps:
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.
You can search not just based on an IATA code, but also based on a ISO country code. Simply change the query string.
|
|
We are curious to see how you are using our free API, feel free to tell us about your latest project through the contact us section or by leaving a comment.