aqi.el | ||
LICENSE | ||
README.org |
Air Quality Index (AQI)
The aqi
package provides an interface
to the World Air Quality Index.
“The World Air Quality Index project is a non-profit project started in 2007. Its mission is to promote air pollution awareness for citizens and provide a unified and world-wide air quality information. The project is providing transparent air quality information for more than 100 countries, covering more than 12,000 stations in 1000 major cities, via those two websites: aqicn.org and waqi.info.”
“The Air Quality Index is based on measurement of particulate matter (PM2.5 and PM10), Ozone (O3), Nitrogen Dioxide (NO2), Sulfur Dioxide (SO2) and Carbon Monoxide (CO) emissions. Most of the stations on the map are monitoring both PM2.5 and PM10 data, but there are few exceptions where only PM10 is available.”
Further information can be found on the WAQI site, in particular the sources & coverage, API docs and FAQ.
Installation, configuration and use
The aqi
package can be installed from
MELPA or manually via github.
To access the WAQI project API it’s necessary to register at http://aqicn.org/data-platform/token/
and generate a key. Once you have your API key it can be configured via
use-package
, M-x customize
or manually.
use-package aqi
(setq aqi-api-key "your-api-key“
:config ( aqi-use-cache t)
The simplest way to view AQI info is with M-x aqi-report
which displays air quality info
for your algorithmically derived location (equivalent to the location
"here") or the name of a place. A place can be the name of a city (in
which case the nearest monitoring station is used) or the id of specific
monitoring station.
By name…
"Ulaanbaatar") (aqi-report
By id…
"@7397") (aqi-report
A detailed report is displayed by default and a single line summary
can be provided by using the keyword 'brief
"Taipei" 'brief) (aqi-report
To use the data programmatically, the functions aqi-report-full
and aqi-report-brief
return the report as a string.
The function aqi-city-aqi
will return the
AQI for a given city as a number.
"Osaka") (aqi-city-aqi
There are macros that can be used to create accessors for specific
data points from the city/station feed. For example, (aqi--make-city-raw-accessor 'aqi-station .attribution)
will create the function aqi-station
which
returns the attribution
field as specified
in the API reference.