Madrid pollution visualization

During the last months there has been considerable debate here in Madrid about the high levels of pollution, how it affects population and how to fix this huge problem. The city of Madrid through its open data portal publishes tons of useful information on its website, so we thought about doing a small visualization to show pollution levels in real-time using Streamkit.

Streamkit allows to poll data at different rates and exposes these streams as events at specific endpoints which can be configured as public or private. We created a new events stream using the Madrid pollution data:

streamkit new mad_env http://www.mambiente.madrid.es/opendata/horario.txt

To create the React application we have used our still-under-development streamkit-js library, please let us know any issue you found or features you expect.

The core piece of this application is a React component which basically imports streamkit-js, queries the public mad_env stream and parses its output (Madrid open pollution data uses CSV) to create a heatmap on top of Google Maps. Here is the result: