defra-air-quality-js
v2.0.0
Published
Formats and exposes the UK Defra Air Quality data
Downloads
32
Readme
Defra UK Air Quality data formatter
A Node.js library for scraping, formatting and returning Defra Air Quality data
About
This library exposes a full, formatted list of air quality measurement stations around the UK, and helper methods for finding specific stations based on name or location.
Installation
$ npm install defra-air-quality-js --save
Usage
See the ./examples
directory for various use cases.
.list()
- List all stations
defraAirQuality
.list()
.then(stations => {
// stations - Array of stations
});
.findByName()
- Find a specific station by name
defraAirQuality
.findByName('Auchencorth Moss')
.then(station => {
// station - The requested station
});
.findByNearestLocation()
- List all stations
defraAirQuality
.findByNearestLocation(51.501476, -0.140634)
.then(station => {
// station - The nearest station to the supplied latitude and longitude
});
Source data
The data source for this library is Defra's UK Air quality https://uk-air.defra.gov.uk/assets/rss/current_site_levels.xml, which is updated hourly.
Tests
This library has a full mocha
test suite, which can be triggered by running:
$ npm test