Python — Flight Data Live Visualization

Build a Kafka Consumer with Python

Techletters
6 min readDec 12, 2022
Build A Kafka Consumer With Python
Image by Edar from Pixabay.

Today we will consume airplane location data and generate a live map with current flights and their position. Welcome to Python Data Science December #12.

We will not only learn about Python, Flask, Kafka & Pykafka, but also we need to leave our Python comfort zone and use a little bit of JavaScript to build our real-time map visualization. JavaScript & its Leaflet.JS library simply gives us better tools to build live maps compared to Python Folium.

This story is a follow-up to the last story in which we set up Kafka Producers with Python for five airplane flights. At the end of the day, we have a real-time map as shown in the below .gif.

Real-time flight map with Python, Kafka & JavaScript. Image by the author

All resources, datasets, required Python libraries & installations are listed at the end of the story, in the chapter Summary & Resources.

💻 Kafka Consumer With Python

In the last story, we have created five different Kafka Producers simulating five different airplane flights. Now we will create one central Kafka Consumer and we can do this in only 4 lines of code.

--

--