Using SAS® and Google Earth ™ to Access and Display Air Pollution Data RTSUG Meeting September 10, 2008 Joshua Drukenbrod U.S. EPA Office of Air Quality.

Slides:



Advertisements
Similar presentations
HTML Basics Customizing your site using the basics of HTML.
Advertisements

HTML Tags and Their Functions
Learning the Basics – Lesson 1
1 Google Earth Powered by MapGuide. 2© 2006 Autodesk Session Outline MapGuide / Google Earth Integration Overview Demo How it Works and How to Use It.
KompoZer. This is what KompoZer will look like with a blank document open. As you can see, there are a lot of icons for beginning users. But don't be.
10. NLTS2 Documentation Overview. 1 Prerequisites Recommended modules to complete before viewing this module  1. Introduction to the NLTS2 Training Modules.
AN INTRODUCTION TO PL/SQL Mehdi Azarmi 1. Introduction PL/SQL is Oracle's procedural language extension to SQL, the non-procedural relational database.
Java Script Session1 INTRODUCTION.
Cascading Style Sheets
CSS cont. October 5, Unit 4. Padding We can add borders around the elements of our pages To increase the space between the content and the border, use.
Web Design with Cascading Style Sheet Lan Vu. Overview Introduction to CSS Designing CSS Using Visual Studio to create CSS Using template for web design.
TEA/TUG + ALDOT(Mobile) = H(O+I) The TEA/TUG being hosted by ALDOT in Mobile causes Hurricanes to come to Alabama. The TEA/TUG being hosted by ALDOT in.
HCI 201 Week 6 Client Side Image Maps Introduction to CSS.
Guide To UNIX Using Linux Third Edition
Basic And Advanced SAS Programming
4.01 Cascading Style Sheets
1 Advanced PowerPoint Cliff Solomon. 2 Presentation Outline Inserting Movies and Animations Into Your Presentations Using Progressive Disclosures and.
IBIS GIS Mapping Missouri “Show and Tell”. Outline 1.What is KML 2.Why we chose KML 3.Show and Tell.
XP New Perspectives on Microsoft Access 2002 Tutorial 71 Microsoft Access 2002 Tutorial 7 – Integrating Access With the Web and With Other Programs.
With Alex Conger – President of Webmajik.com FrontPage 2002 Level I (Intro & Training) FrontPage 2002 Level I (Intro & Training)
Designing a Classroom Web Site Using NVU Beginning Level.
HTML Tags. Objectives Know the commonly used HTML tags Create a simple webpage using the HTML tags that will be discussed.
Presenting Information on WWW using HTML. Presenting Information on the Web with HTML How Web sites are organized and implemented A brief introduction.
CHAPTER 14 Formatting a Workbook Part 1. Learning Objectives Format text, numbers, dates, and time Format cells and ranges CMPTR Chapter 14: Formatting.
Integration of APPX Applications with Google Earth © John Selvage, Selvage Custom Software APPX Conference - October 2011.
Informer Web Reporting Basic Reporting
Movie Maker in the High School Classroom Professional Development Workshop September 1, 2009 Facilitator: Heidi Camp Swartz Creek High School.
Copyright © 2006, SAS Institute Inc. All rights reserved. Enterprise Guide 4.2 : A Primer SHRUG : Spring 2010 Presented by: Josée Ranger-Lacroix SAS Institute.
Using Dreamweaver. Slide 1 Dreamweaver has 2 screens that do different things The Document window where you create your WebPages The Site window where.
4-1 INTERNET DATABASE CONNECTOR Colorado Technical University IT420 Tim Peterson.
© Ms. Masihi.  The Dreamweaver Welcome Screen first opens when you start Dreamweaver.  This screen gives you quick access to previously opened files,
AQS Web Quick Reference Guide Changing Raw Data Values Using Maintenance 1. From Main Menu, click Maintenance, Sample Values, Raw Data 2. Enter monitor.
Moodle (Course Management Systems). Assignments 1 Assignments are a refreshingly simple method for collecting student work. They are a simple and flexible.
ELG 3120 Signal and System Analysis 1 Introduction to MATLAB TAs Wei Zhang Ozgur Ekici (Section A)(Section B) ELG 3120 Lab Tutorial 1.
Data File Access API : Under the Hood Simon Horwith CTO Etrilogy Ltd.
Section 4.1 Format HTML tags Identify HTML guidelines Section 4.2 Organize Web site files and folder Use a text editor Use HTML tags and attributes Create.
 This presentation introduces the following: › 3 types of CSS › CSS syntax › CSS comments › CSS and color › The box model.
Web Page Design I Basic Computer Terms “How the Internet & the World Wide Web (www) Works”
Using KML, XML, and XSL to Create Google Earth Applications: A Tutorial Betsy Page Sigman and William Garr Georgetown University Southeast Decision Sciences.
Support.ebsco.com EBSCOhost Visual Search Tutorial.
Learning to love the SAS LAG function Phuse 9-12 October 2011 Herman Ament, MSD, Oss NL Phuse 9-12 October 2011.
Addison Wesley is an imprint of © 2010 Pearson Addison-Wesley. All rights reserved. Chapter 5 Working with Images Starting Out with Games & Graphics in.
Unit 2, cont. September 12 More HTML. Attributes Some tags are modifiable with attributes This changes the way a tag behaves Modifying a tag requires.
PowerBuilder Online Courses - by Prasad Bodepudi
Microsoft Office 2007 Intermediate© 2008 Pearson Prentice Hall1 PowerPoint Presentation to Accompany GO! With Microsoft ® Office 2007 Intermediate Chapter.
Macro Overview Mihaela Simion. Macro Facility Overview Definition : The SAS Macro Facility is a tool within base SAS software that contains the essential.
1 Chapter 2: Working with Data in a Project 2.1 Introduction to Tabular Data 2.2 Accessing Local Data 2.3 Accessing Remote Data 2.4 Importing Text Files.
Introduction to Enterprise Guide Jennifer Schmidt Rhonda Ellis Cassandra Hall.
Georgia Institute of Technology Making Text for the Web Barb Ericson Georgia Institute of Technology March 2006.
Accessing and Using Fire-Related Data with the CAPITA DataFed.net* Services Framework Stefan Falke Rudolf Husar Kari Hoijarvi Washington University in.
1 Introduction To Geographical Data and TEISS Maps Angelique Luedeker, ITEP/TAMS Center.
Web Foundations WEDNESDAY, NOVEMBER 20, 2013 LECTURE 32: DREAMWEAVER SLIDE SHOW AND GOOGLE MAP.
1 HTML Frames
1 © Netskills Quality Internet Training, University of Newcastle Using Style Sheets in Dreamweaver CS © Netskills, Quality Internet Training, University.
David Lawrence 7/8/091Intro. to PHP -- David Lawrence.
Mapping local community assets online Read this if you want to learn how to: 1)Create online maps of local community assets using Google Maps 2)Allow other.
HTML Basics. HTML Coding HTML Hypertext markup language The code used to create web pages.
8 Chapter Eight Server-side Scripts. 8 Chapter Objectives Create dynamic Web pages that retrieve and display database data using Active Server Pages Process.
Spiderman ©Marvel Comics Creating Web Pages (part 1)
Chapter 2 Getting Data into SAS Directly enter data into SAS data sets –use the ViewTable window. You can define columns (variables) with the Column Attributes.
CHAPTER 7 LESSON C Creating Database Reports. Lesson C Objectives  Display image data in a report  Manually create queries and data links  Create summary.
Based on Learning SAS by Example: A Programmer’s Guide Chapters 1 & 2
Web Development & Design Foundations with HTML5 8th Edition
Learning the Basics – Lesson 1
Madam Hazwani binti Rahmat
Web Development & Design Foundations with HTML5
Intro to PHP & Variables
What are Cascading Stylesheets (CSS)?
Tutorial 7 – Integrating Access With the Web and With Other Programs
Presentation transcript:

Using SAS® and Google Earth ™ to Access and Display Air Pollution Data RTSUG Meeting September 10, 2008 Joshua Drukenbrod U.S. EPA Office of Air Quality Planning Standards

Improve access to emissions information Provide information in easy-to-use format Provide direct link to data Background Purpose

Previous “high-level” emissions pages on our web site… Do not provide data in an “easy-to-use” format Do not answer some of the most common questions Do not provide the spatial, temporal, or sector-specific resolution many people need Background

How are we changing that? Linking the site directly to the data, providing… National, state, and local summaries Source category detail not previously available Geospatial access not previously available Background

SAS/IntrNet – What is it? Component of SAS that enables dynamic access to programs and data via the Web Anything you can program in SAS can be output to Web browser/Google Earth Users don’t need to have SAS or know how to use SAS How it Works

SAS program queries data Workstation (Web Interface or Google Earth™) Web Server (SAS/Internet®) Database (Oracle, Access DB) Data returns to program Web Page/Google Earth links to SAS service Results displayed in Web browser or Google Earth placemark SAS/IntrNet – How does it work? Program generates results How it Works

Getting Started A SAS/IntrNet service must be set up to utilize online capabilities. A quick read through Google’s KML Reference guide will help with the basics of creating custom kml files. Data must include either (lat & long) or (county & state fips) for point plotting in Google Earth. Determine variable for analysis when creating coloring counties. Determine a “color scheme” for counties. Data MUST include either (county & state) FIPS or (county & state) name when coloring counties. Plotting Points and Coloring Counties

Getting Started Output data to an external file using the file extension kml. Data is output through a series of PUT statements. KML support of HTML provides increased flexibility on how to display data in the placemark windows. Using SAS to develop these kml files allows for more efficient coding and provides the abilities to plot conditionally. SAS provides county perimeter coordinates when developing county colored kml files. Creating KML files

Plotting Points Step 1: Prepare data for creating kml files. Standard cleaning of data. Determine if placemark elevation is a feature you will like to use then determine variable to base elevation on. Determine if data includes (lat & long) or (county & state fips).

Plotting Points Step 2: Create kml file. Name your kml file in filename path: filename - ex. Filename kmlfile ‘C:\Documents and Settings\user\Desktop\mykml.kml Be sure to include.kml extension.

Plotting Points (Step 2 cont’d) Begin data step for creating kml. When creating kml files a basic format is used in kml writing. 1 “location if placemark icon” A name here #A 1 (relativeToGround, clampedToGround or absolute) Long,Lat,Elevation

Plotting Points (Step 2 cont’d) A sample SAS data step is: data _null_; file ; set end=last; if _n_ = 1 then do; put ‘ ’; put ‘ ’; put ‘ 1 ’; put ‘ ’; put ‘ “location if placemark icon” ’; put ‘ ’; end;

Plotting Points (Step 2 cont’d) After this initial step we must prepare the lat & longs for the kml file by removing white spaces. points = ‘ ’||trim(left(xcoord))||’,’||trim(left(ycoord))||’,0 ’; Using the basic kml format and a put statement in SAS, we are able to plot our data in Google Earth. ………. put ‘ ’; put ‘ A name here ’; put ‘ #A ’; put ‘ ’; put ‘ 1 ’; put ‘ (relativeToGround or clampedToGround or absolute) ’; put points ; put ‘ ’; put ‘ ’; …………….

Plotting Points Step 3: Closing the kml file. Closing the kml file in SAS is as simple as opening the file: …………put ‘ (relativeToGround or clampedToGround or absolute) ’; put points; put ‘ ’; put ‘ ’; ……………. if last then do; put ‘ ’;

data _null_; file ; set end=last; if _n_ = 1 then do; put ‘ ’; put ‘ ’; put ‘ 1 ’; put ‘ ’; put ‘ “location if placemark icon” ’; put ‘ ’; end; points = ‘ ’||trim(left(xcoord))||’,’||trim(left(ycoord))||’,0 ’; put ‘ ’; put ‘ A name here ’; put ‘ #A ’; put ‘ ’; put ‘ 1 ’; put ‘ (relativeToGround or clampedToGround or absolute) ’; put points; put ‘ ’; if last then do; put ‘ ’; end; run;quit;

Writing in Description Balloons Very simple knowledge of html is required along with a few extra lines of code. ……………………. put ' '; put '<![CDATA['; put (Any html coding is done between the line above and below); put ']]>'; put ' '; …………………….

Using SAS/Intrnet Service Place link to service within the description tag. ……………………. put ' '; put '<![CDATA['; link='<img src=" '&_program=dataprog..sas'|| '&year1='||"&year1"|| '&year2='||"&year2"|| ‘&debug=0'|| '&site='||trim(left(site_id))|| '"width="460" height="360">'; put link; put ']]>'; put ' '; …………………….

County Coloring Step 1: Prepare data for kml files. Standard cleaning of data. Determine variable for analysis. Determine color scheme. Data must include (county & state) fips and/or county name.

County Coloring Step 2: Perform any analyses required on data and determine levels for coloring counties. (i.e. Q1, median, Q3) Assign levels to macro variables. Example: proc univariate data = USmap3 noprint;var dense; output out = USmap pctlpts= pctlpre=P;run;quit; data test; set USmap; call symput('first',P30); call symput('second',P60); call symput('third',P90); run;quit;

County Coloring Step 3: Create variable for each observation to hold hexadecimal color code. Note: hexadecimal color codes are slightly different in Google Earth. The order is aabbggrr while standard web hexadecimal is rrggbb. aa = alpha (00 to ff). For alpha, 00 is completely transparent and ff is completely opaque. bb = blue (00 to ff) gg = green (00 to ff) rr = (00 to ff). The range of any one color is from 0 to 255. A list of hexadecimal colors may be found online.

County Coloring (Step 3 cont’d) Temporary datastep example: data temp; set mapdata3; length one 8 two 8 three 8; one = &first; two = &second; three = &third; if dense >= three then do; color = 'c ';end; *Top 10 percent color is black for all pollutants; if two <= dense < three then do; color = &color1;end; *60 th -90th; if one <= dense < two then do; color = &color2;end; *30th-60th; if dense < one then do; color = &color3;end; *0-30th; run;quit;

County Coloring Step 4: Retrieve perimeter lat / long for each county. Lat / long stored in SAS maps.counties Lat / long stored in radians Dataset includes (county & state) fips Lat / long must be converted to degrees. Lat / long must be ordered in counter- clockwise order for Google Earth to plot correctly.

County Coloring Step 5: Prepare perimeter lat / long coordinates. data county; set maps.counties; if state ^= &stfips then do; delete;end; if density > 4 then do; *remove high density for lower resolution map; delete;end; if segment > 1 then do;*remove multiple segments; delete;end; if x = ‘.’ OR y = ‘.’ then do; *remove missing data in maps.counties; delete;end; *Convert radian lat / long to degrees; pi = gamma(0.5)**2; long = x * -(180/pi); lat = y * (180/pi); elev = 3000; *preset elevation for kml plotting; run;quit;

County Coloring Step 6: Putting lat / long in counter-clockwise order. Sort both datasets (temp & county) by county fips then merge: data count; set merged; by county; if first.county then counter=0 and num = 0; counter+1; if last.county then num = counter; run;quit; proc sort data = count; by county_name descending counter; run;quit; data nums; set count; if num = '.' then do; delete; end; run;quit;

County Coloring Step 7 & 8: Prepare array’s and do statements for lat / long (Note: 2 counties & all of Alaska require a different method) This step involves a smaller section of code which writes the arrays to hold the lat / long. *write code to text file for arrays; data _null_; set nums; file ‘C:\Documents and Settings\user\Desktop\arrays.txt’;; ifname = 'if county_name = "'||trim(left(county_name))||'" then do;'; temp = lowcase(county_name); shrtname = substr(temp, 1, 8); cut = compress(shrtname,".","s"); arname = 'array lo'||trim(left(cut))||'('||trim(left(num))||') long1-long'||trim(left(num))||';'; arname2 = 'array lt'||trim(left(cut))||'('||trim(left(num))||') lat1-lat'||trim(left(num))||';'; ends = 'end;'; put ifname; put arname; put arname2; put ends; run;quit;

County Coloring This section writes the do statements. data _null_; set nums; file 'C:\Documents and Settings\user\Desktop\dos.txt’; temp = lowcase(county_name); name = substr(temp, 1, 8); cut = compress(temp,".","s"); name2 = 'if county_name = "'||trim(left(county_name))||'" then do;'; dos = 'do i=1 to '||trim(left(num))||';'; cords = 'cord = trim(left(lo'||trim(left(cut))||'(i)))||'',''||trim(left(lt'||trim(left(cut))||'(i)))||'',3000 '';'; pcord = 'put cord;'; ends = 'end;end;'; put name2; put dos; put cords; put pcord; put ends; run;quit;

County Coloring Step 9: Prepare lat / long for storing in arrays and printing to kml file. proc transpose data = count out = count1 prefix = long; by county_name county_fips color; var long; run;quit; proc transpose data = count out = count2 prefix = lat; by county_name county_fips color; var lat; run;quit; data latlong; merge count1 count2; by county_name; run;quit;

County Coloring Step 10: Creating our county colored kml overlay. data _null_; set latlong end=last; file ; If county_name = “” then do; delete;end; *Paste arrays written to text file here. Arrays must be defined and used in the same datastep. if _n_ = 1 then do; put ' '; put ' Alabama '; end; style = ' '; *This is a style reference specific to kml and does not necessarily need county fips; put style; put ' '; col = ' '||trim(left(color))||' '; put col; put ' '; put ' ' county_name ' '; styleurl = ' #exNAME'||trim(left(county_fips))||' '; *style ref call specific to kml; put styleurl; put ' '; put ' relativeToGround '; put ' ' ; *Paste do statements written to text file here. This will call on the arrays and write the lat / long to the kml file; put ' ' ; if last then do; put ' '; put ‘ ’; end; run;quit;

Special Cases There are a handful of special cases: Denver, CO Miami-Dade, FL The state of Alaska Maps.counties does not have perimeter coordinates for these cases. Perimeters must be defined slightly different.

Special Cases Before creating the kml file a _null_ datastep must be performed to define the perimeters. Ex. Using Denver, CO: data _null_; set latlong; if county_name = "Denver" then do; initial = 8; call symput('denv0', initial); call symput('denv1', " , , , , , ,3000"); call symput('denv2', " , , , , , , , ,3000"); call symput('denv3', " , , , , , , , ,3000"); call symput('denv4', " , , , , , , , ,3000"); call symput('denv5', " , , , , , , , ,3000"); call symput('denv6', " , , , , , , , ,3000"); call symput('denv7', " , , , , , , , ,3000"); call symput('denv8', " , , , , , , , ,3000");end; run;quit;

Special Cases After defining these macro variables in this fashion a simple do loop will insert these coordinates into the kml file. if county_name = "Denver" then do; %do i=1 %to &denv0; put "&&denv&i"; %end; end;

How do we expect to benefit? Easier access to emissions information Information in easy-to-use formats Ability to answer more questions Site easier to maintain Efficient use of our data systems Saves staff time and resources Conclusions

Questions?