Maker Portal

View Original

Airport Destination Mapper in Real Time

See this content in the original post
See this content in the original post

https://www.flickr.com/photos/superjetinternational/5476115362


See this content in the original post

https://commons.wikimedia.org/wiki/File:Macedonia_International_Airport_map.svg

There is an open-source database of airport information that can be found at:

See this content in the original post

The site hosts multiple files full of information about runways, airport communication frequencies, and general geographic data. I will be using the file named 'airports.csv,' which contains latitude, longitude, elevation, country, and International Air Transport Association (IATA) codes that will help us uniquely identify each airport from its call sign mentioned in the flight destination data discussed in the next section.

A direct download of airport data can be found at the link below:

See this content in the original post

Make sure to save the 'airports.csv' file to the local directory before proceeding to the next section and beyond.


See this content in the original post

Flight Aware is a website that contains live-tracking information about flights across the world. It has arrival, departure, en-route, and scheduled flight information, among other features regarding aircraft, weather, and general aviation guidance. 

I will be focusing on the scheduled airport departures to create a real-time visualization for outgoing flights using the web format outlined below:

 

See this content in the original post

This format tells Flight Aware a few things:

See this content in the original post

Using the coding above, the user can change the airport identification code to their desired airport and the rest can stay the same. In the code in a later section, I will demonstrate how to iterate through the offset to get future departures as well.


See this content in the original post

The scheduled departures site is a table full of information about airline, aircraft, destinations, and departure and arrival times. We will crawl this table format to acquire information that we can then plot using Python to create a live destination mapper.

The table can be crawled by identifying the start and end points of each column and row of the table using html code. The html points look something like this:

See this content in the original post

The full code is referenced below with comments, so I won't spend much time discussed the minutia of the methods. It's by no means at all the most efficient or most well-written code, however, it runs at a reasonable speed. Additionally, many of the methods used in the plotting have been used in previous tutorial, so please reference those for further elaboration.

See this content in the original post

See this content in the original post

In this short tutorial, I brought together many of the aspects cover in my live-plotting series using Python. Above, I introduced a method for plotting real-time airport destinations by first downloading a database of airport information. Then, I discussed the website Flight Aware and how to use its live-tracking application to retrieve information about flights from a specific airport. Then, I presented a code that crawls the Flight Aware webpage for scheduled destinations to plot airport information using the IATA code from Flight Aware and the airport information from the airport database to create a visual representation of flight destinations from any airport in the world. This entry into the live-plotting series was meant to combine many of the tools used in previous tutorials, and I hope the application was interesting and helpful to the user. 

See this content in the original post

See More in Programming and Python:

See this gallery in the original post