airnow.js
airnow is a module for making HTTP requests to the airnowapi.org webservices API.
Installation
npm install airnow --save
Quick Examples
var airnow = ; var client = ; // get the forecast by zipclient; // get the forecast by latitude and longitudeclient; // get the observations by zipclient; // get the observations by latitude and longitudeclient; // get the observations by a bounded box monitoring siteclient; // get historical observations by a zip codeclient; // get historical observations by latitude and longitudeclient;
Features
- Forecasts
- Observations (current & historical)
- Brute force retries of the HTTP calls
getForecastByZipCode
Get a forecast for a zip code on a particular date.
example
var airnow = ; var client = ; // build my optionsvar options = zipCode: "53703" date: distance: 100 format: "application/json"; // get the forecast by zipclient;
options
Parameter | Description | Type | Required |
---|---|---|---|
zipCode | Zip code | String | Yes |
date | Date of forecast. If date is omitted, the current forecast is returned. | Date | No |
distance | If no reporting area is associated with the specified Zip Code, return a forecast from a nearby reporting area within this distance (in miles). | Number | No |
format | Format of the payload returned. Defaults to "application/json" and the response will be a parsed JSON object. "text/csv" "application/json" "application/xml" | String | No |
getForecastByLatLong
Get a forecast for a latitude and longitude pair for a particular date
example
var airnow = ; var client = ; // build my optionsvar options = latitude: 3833 longitude: -12228 date: distance: 100 format: "application/json"; // get the forecast by latitude and longitudeclient;
options
Parameter | Description | Type | Required |
---|---|---|---|
latitude | Latitude in decimal degrees | Number | Yes |
longitude | Longitude in decimal degrees | Number | Yes |
date | Date of forecast. If date is omitted, the current forecast is returned. | Date | No |
distance | If no reporting area is associated with the specified latitude and longitude, return a forecast from a nearby reporting area within this distance (in miles). | Number | No |
format | Format of the payload returned. Defaults to "application/json" and the response will be a parsed JSON object. "text/csv" "application/json" "application/xml" | String | No |
getObservationsByZipCode
Gets the current observations for a single zip code.
example
var airnow = ; var client = ; // build my optionsvar options = zipCode: "53703" distance: 100 format: "application/json"; // get the current observations by zipclient;
options
Parameter | Description | Type | Required |
---|---|---|---|
zipCode | Zip Code | String | Yes |
distance | If no reporting area is associated with the specified Zip Code, return a forecast from a nearby reporting area within this distance (in miles). | Number | No |
format | Format of the payload returned. Defaults to "application/json" and the response will be a parsed JSON object. "text/csv" "application/json" "application/xml" | String | No |
getObservationsByLatLng
Gets the current observations for a latitude and longitude pair.
example
var airnow = ; var client = ; // build my optionsvar options = latitude: 3833 longitude: -12228 distance: 100 format: "application/json"; // get the current observations by latitude and longitudeclient;
options
Parameter | Description | Type | Required |
---|---|---|---|
latitude | Latitude in decimal degrees | Number | Yes |
longitude | Longitude in decimal degrees | Number | Yes |
distance | If no reporting area is associated with the specified latitude and longitude, return a forecast from a nearby reporting area within this distance (in miles). | Number | No |
format | Format of the payload returned. Defaults to "application/json" and the response will be a parsed JSON object. "text/csv" "application/json" "application/xml" | String | No |
getObservationsByMonitoringSite
Get observations for a bounded box monitoring site.
example
var airnow = ; var client = ; // build my optionsvar options = latitude: 3833 longitude: -12228 distance: 100 format: "application/json"; // get the observations by monitoring siteclient;
options
Parameter | Description | Type | Required |
---|---|---|---|
latitude | Latitude in decimal degrees | Number | Yes |
longitude | Longitude in decimal degrees | Number | Yes |
distance | If no reporting area is associated with the specified latitude and longitude, return a forecast from a nearby reporting area within this distance (in miles). | Number | No |
format | Format of the payload returned. Defaults to "application/json" and the response will be a parsed JSON object. "text/csv" "application/json" "application/xml" | String | No |
getHistoricalObservationsByZipCode
Get historical observations for a zip.
example
var airnow = ; var client = ; // build my optionsvar options = zipCode: "53703" date: 1448984256072 distance: 100 format: "application/json"; // get the historical observations by zip codeclient;
options
Parameter | Description | Type | Required |
---|---|---|---|
zipCode | Zip Code | String | Yes |
date | date of observations | Date | Yes |
distance | If no reporting area is associated with the specified Zip Code, return a forecast from a nearby reporting area within this distance (in miles). | Number | No |
format | Format of the payload returned. Defaults to "application/json" and the response will be a parsed JSON object. "text/csv" "application/json" "application/xml" | String | No |
getHistoricalObservationsByLatLng
Get historical observations for a latitude and longitude pair.
example
var airnow = ; var client = ; // build my optionsvar options = latitude: 3833 longitude: -12228 date: 1448984256072 distance: 100 format: "application/json"; // get the historical observations by latitude and longitudeclient;
options
Parameter | Description | Type | Required |
---|---|---|---|
latitude | Latitude in decimal degrees | Number | Yes |
longitude | Longitude in decimal degrees | Number | Yes |
date | date of observations | Date | Yes |
distance | If no reporting area is associated with the specified latitude and longitude, return a forecast from a nearby reporting area within this distance (in miles). | Number | No |
format | Format of the payload returned. Defaults to "application/json" and the response will be a parsed JSON object. "text/csv" "application/json" "application/xml" | String | No |
Contributing
The more PRs the merrier. :-)