apps & more with the airnow api 5883 steven ludewig 1, john white 2, phil dickerson 2, alan...
TRANSCRIPT
Apps & More With the AirNow API
5883
Steven Ludewig1, John White2, Phil Dickerson2, Alan Healy1,
Jonathan West1, Leslie Prince1
1Sonoma Technology, Inc., Petaluma, CA
2U.S. EPA, Research Triangle Park, NC
for
2014 National Air Quality Conference
Durham/RTP, North CarolinaFebruary 12, 2014
Information Reach (1)
2
AirNow.org Website
Weather Service Providers
EnviroFlash Messages
EPA & Agency Mobile Apps
Agency Websites
AirNowForecasts
ObservationsData Products
Air quality information is published in well-planned, well-understood ways.
Information Reach (2)
3
AirNow.org Website
Weather Service Providers
EnviroFlash Messages
EPA & Agency Mobile Apps
Agency Websites
AirNowForecasts
ObservationsData Products
API Air quality information can be easily accessed and published in various ways by software developers.
Information Access TrendsGot a Smartphone?• 91% of people have a mobile
phone. • 55% of people own a
smartphone. • 50% of mobile phone users use
mobile as their primary Internet source.
• Mobile adoption is growing 8 times faster than web adoption grew in the 1990s and early 2000s.
• Global mobile traffic now accounts for 15% of all Internet traffic.
• Mobile-based searches make up one quarter of all searches.
4
Sources: PewInternet.org; DigitalBuzzBlog.com/SuperMonitoring.com
5AirNow API
AirNowAPI.orgA central portal providing access to web services, RSS feeds, and file products, giving developers the tools needed to integrate air quality data into software applications (e.g., websites, mobile apps)
API Features• Key web services requested by users
– Forecasts and observations by zip code or lat/lon– Historical peak values by zip code or lat/lon– KML web services
• A query tool makes it possible for users to assemble and run web service requests, helping developers to quickly grasp the proper format ofthe API’s REST-type requests and to view outputs
Description and Features
6AirNow API
API Features (continued)
• Documentation provides developers with quick answers, including − Inputs for each web
service with a description, the required format, and examples
− Outputs returned by the web service with descriptions of each field
− Frequently asked questions− An “Air Quality 101” page
with information about the data
7AirNow API
API Features (continued)
• KML Contour web services
(currently in beta release)
return gridded outputs of PM2.5, ozone, or combined
AQI values. These web services return data contours for a user-selected geographic area.
• Operations and performance features include rate limiting, caching, and activity logging.
8AirNow API
Based on user response and requests, additions may include a web service that returns AQI and concentration values in a variety of formats (e.g., KML, CSV, JSON, XML) for a user-specified geographic area, parameter, and date/time range.
Next Steps
9
REST-type URL Requesthttp://www.airnowapi.org/aq/forecast/zipCode/?format=text/csv&zipCode= 27511&date=2014-02-03&distance=25&API_KEY=9985988E-D56F-E5112
Example OutputsCSV: "DateIssue","DateForecast","ReportingArea","StateCode","Latitude","Longitude","ParameterName", "AQI", "CategoryNumber","CategoryName","ActionDay","Discussion“ "2014-02-02 ","2014-02-03 ","Raleigh-Durham-Chapel Hill","NC","35.878","-78.787","O3","-1","1","Good","false","“ …
JSON: [{"DateIssue":"2014-02-03 ","DateForecast":"2014-02-04 ","ReportingArea":"Raleigh-Durham-Chapel Hill","StateCode":"NC","Latitude":35.878,"Longitude":-78.787,"ParameterName":"O3","AQI":-1,"Category":{"Number":1,"Name":"Good"},"ActionDay":false,"Discussion":""}, …
XML: <ForecastByZipList><ForecastByZip><DateIssue>02/03/2014 12:00:00 AM</DateIssue> <DateForecast>02/04/2014 12:00:00 AM</DateForecast><ReportingArea>Raleigh-Durham-Chapel Hill</ReportingArea><StateCode>NC</StateCode><Latitude>35.878</Latitude><Longitude>-78.787</Longitude><ParameterName>O3</ParameterName><AQI>-1</AQI><CategoryNumber>1 </CategoryNumber><CategoryName>Good</CategoryName><ActionDay>False</ActionDay> <Discussion></Discussion>
Using the AirNow API
10
A Simple Web Display
<html> <body> <h2>Example Forecast</h2> <table id="dataTable"></table> </body> <script>
var data =[{"DateIssue":"2014-02-02 ","DateForecast":"2014-02-03 ","ReportingArea":"Raleigh-Durham-Chapel Hill","StateCode":"NC","Latitude":35.878,"Longitude":-78.787,"ParameterName":"O3","AQI":-1,"Category":{"Number":1,"Name":"Good"},"ActionDay":false,"Discussion":""}];
var html = "";
for(var i = 0; i < data.length; i++) { var dataRec = data[i];
html += '<tr align=center><td>' + dataRec.DateIssue + '</td><td>' + dataRec.DateForecast + '</td><td>' + dataRec.ReportingArea + '</td><td>' + dataRec.ParameterName + '</td><td bgcolor=' + AQIcolor + '>' + AQI + '</td><td bgcolor=' + AQIcolor + '>' + dataRec.Category.Name + '</td></tr>';
}html = '<tr align=center><th>Issue Date</th><th>Forecast Date</th><th>Reporting Area</th><th>Parameter</th> <th>AQI</th><th>Category</th></tr>' + html;
document.getElementById("dataTable").innerHTML = html;
</script></html>
Using the AirNow API
11
Mobile Apps pass user requests to the API and display the response.
Using the AirNow API
http://www.airnowapi.org/aq/forecast/zipCode/?format=text/csv&zipCode= 27511&date=2014-02-03&distance=25&API_KEY=9985988E-D56F-E511
Questions?
?
12
Steven LudewigSonoma Technology, [email protected]
Phil DickersonU.S. [email protected]
John WhiteU.S. [email protected]
Contact