API purpose: Getting London Air Quality Data
Signup: None, its open data
Comment: Really well made API, not real time though, about a day delay
So Kings College run an array of air quality monitors across London. Its a really interesting piece of data to work with that is so relevant to our day to day lives. Thought I would have a look at the API and try to pull the data from my nearest air quality monitor to my home.
The call from the API documentation requires the use of their site codes to work, which isn’t the most intuitive. A quick peruse of the maps at particulate matter. Cool so IS2 is my air quality roadside monitor. As a bonus there’s 15 years of data from the monitor.
So here is the link to the call we want. It actually leads to a pretty straightforward script. [Edit an hour later]. Getting strings converted to floats is apparently not straight forward. Anywho, here’s the completed script. As always I explain the crap out of the code in the code so I think it kind of explains itself!
So when I run python AQ.py.
Unfortunately the air quality today is more than the yearly average target of 40 ug/m3 NO2 in the UK and reads 69.71 ug/m3
Interesting stuff 🙂
So I had the thought of making a bigger project at the end of each week, not necessarily more work but wrapping up the work I’ve done into one bigger program. I have a good idea to wrap this weeks work up which I’ll explain on Monday but its missing one big element. I need to be able to easily calculate the distance between two sets of GPS coordinates. So tomorrow I’ll work on this. I’ll be pulling an address in the UK, converting to GPS data and checking its linear distance to tower bridge in London.