120 likes | 254 Views
Apps & More With the AirNow API. Steven Ludewig 1 , John White 2 , Phil Dickerson 2 , Alan Healy 1 , Jonathan West 1 , Leslie Prince 1 1 Sonoma Technology, Inc ., Petaluma, CA 2 U.S. EPA, Research Triangle Park, NC for 2014 National Air Quality Conference
E N D
Apps & More With the AirNow API 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 Carolina February 12, 2014 5883
Information Reach (1) AirNow.org Website Weather Service Providers EnviroFlash Messages EPA & Agency Mobile Apps Agency Websites AirNow Forecasts Observations Data Products Air quality information is published in well-planned, well-understood ways.
Information Reach (2) AirNow.org Website Weather Service Providers EnviroFlash Messages EPA & Agency Mobile Apps Agency Websites AirNow Forecasts Observations Data Products Air quality information can be easily accessed and published in various ways by software developers. API
Information Access Trends Got 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. Sources: PewInternet.org; DigitalBuzzBlog.com/SuperMonitoring.com
AirNow API Description and Features AirNowAPI.org A 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 servicesrequested 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
AirNow API API Features(continued) • Documentationprovides 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
AirNow 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.
AirNow API Next Steps 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.
Using the AirNow API REST-type URL Request http://www.airnowapi.org/aq/forecast/zipCode/?format=text/csv&zipCode= 27511&date=2014-02-03&distance=25&API_KEY=9985988E-D56F-E5112 Example Outputs CSV: "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 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 Mobile Apps pass user requests to the API and display the response. http://www.airnowapi.org/aq/forecast/zipCode/?format=text/csv&zipCode= 27511&date=2014-02-03&distance=25&API_KEY=9985988E-D56F-E511
Questions? Contact Steven Ludewig Sonoma Technology, Inc. steve@sonomatech.com John White U.S. EPA White.John@epa.gov Phil Dickerson U.S. EPA Dickerson.Phil@epa.gov