google earth and .kml · pdf file1 google earth and .kml files geosci020 class trainers’...
TRANSCRIPT
1
Google Earth and .kmlfiles
GeoSci020 ClassTrainers’ Forum Summer
Camp
Overview of Presentation
• Discussion of GeoSci020 Projects–Q and A
• Overview of components and process–Q and A
• More detailed discussion of specific components (if time permits)–Q and A
2
Use in GeoSci020
• 2 different lab assignments with 2 different goals– stream flow analysis assignment– rock identification assignment
Stream Flow• http://www.de2.psu.edu/faculty/uxg3/google/parivers/
• Use real-time data provided by USGS water monitoring stations along PA rivers–Google Earth used as the interface to
provide access to all data points• e.g. links to USGS web sites
– Put in context where these rivers and stations are located in PA
3
Clicking on a link on a web page downloads a .kml file and launches Google Earth to display the coordinates and points defined in the .kml file
Clicking on a point in Google Earth opens a description containing information about that water monitoring station.
4
Clicking on link in description opens URL in lower portion of Google Earth window.
Cumberland Cemetery• http://www.de2.psu.edu/faculty/uxg3/google/cumberland/
• Geoarchaeological exercise looking at design and different weathering patterns depending on type of stone used for a tombstone–Google Earth used as a backup in
case of inclement weather (snow) limited access to cemetery
5
Web page created and linked to from ANGEL.
Clicking on link downloads .kml file and launched Google Earth.
Points (push pins) mark (via lat/long) location of each tombstone to be studied. Each student assigned specific letters (tombstones)
6
Clicking on push pin opens description including link to web page with supporting materials (images).
Questions on GeoSci020 Projects
Please save ‘how-to’questions until next section.
7
Screen capture of Google Earth showing 3 locations in Valley Forge National Park
Methods Explored for Project• Google Maps API• Use of .kml files
8
Google Maps API
• Must request a ‘key’ from Google• Much more flexibility• Much more programming• Did not see any real benefit in Google
Earth but hope to do more testing• If interested -
– “Beginning Google Maps Applications with PHP and AJAX” Michael Purvis, Jeffrey Sambells, and Cameron Turner
Use of .kml files
• Less functionality but more flexibility since key not required– .kml file is a simple text file containing
latitude and longitude– .kml file is an XML document with specific
tags unique for Google Earth/Maps• Simple copy/paste to add more locations
• User must have Google Earth installed
9
Google Earth
• Current version is 4.1• Free version sufficient• Mac / Windows versions• Download - http://earth.google.com
• Possible to use Google Maps w/.kml files if it is not possible to download Google Earth
Coordinates
• Need latitude and longitude of each location in decimal form–More decimal places, greater
accuracy• Google Earth supports up to 10 decimal
places
10
Coordinates
• Use GPS Unit and record latitude / longitude of each location
• Use http://lat-long.com–Allows searching by location
• Convert to decimal format– http://www.calculatorcat.com/latitude_longitude.phtml
Screen capture of lat-long.com searching on Pennsylvania and then Valley Forge
Screen capture of calculator input
11
Create .kml file
• Simple text file created by Notepad, Dreamweaver, TextEdit(Mac)
• XML file with specific code used by Google Earth / Maps
<?xml version="1.0" encoding="UTF-8"?><kml xmlns="http://earth.google.com/kml/2.1"><Document>
<Placemark><name>Anthony Wayne Statue</name><description>Information about location</description><Point><coordinates>-75.444472,40.08639,0</coordinates>
</Point></Placemark>
</Document></kml>
The code below, saved as a .kml document (e.g. vf.kml)and launched in Google Earth will produce 1 point.
12
<?xml version="1.0" encoding="UTF-8"?><kml xmlns="http://earth.google.com/kml/2.1"><Document><Placemark><name>Muhlenberg's Brigade</name><description><![CDATA[<h3>Field</h3> <a
href="http://www.de.psu.edu/">Intelligently places itself at the height of the underlying terrain.</a>]]></description>
<Point><coordinates>-75.4258,40.0972,0</coordinates>
</Point></Placemark>
</Document></kml> Addition of the ![CDATA[ …]]
statement in the <description> statement allows for html code to be added
Create any ‘support’documents• Optional
–Additional html pages containing more information about the locations (e.g. images, text, etc.)
13
Test locally
• Click and drag icon of .kml file over Google Earth icon to launch Google Earth using the .kml file to load the data
Each time Google Earth loads a .kml file, it is stored in ‘Temporary Places’. During testing, you will not want to save these items. If you do save a test .kml file, it is possible to delete the file from ‘Temporary Places’ (right-click, delete)
14
Moving files to web server
• IF Google Earth not used (using Google Maps instead) - create web page with a link containing following code– href="http://maps.google.com/maps?f=q&hl=en&q=http://
www.de2.psu.edu/faculty/uxg3/google/parivers/SchuylkillandSusquehannaRivers.kml"
1st URL address of Google maps with code to launch external .kml file
2nd URL address of your .kml file
Moving files to web server
• IF Google Earth to be used, following MIME types needed– AddType application/vnd.google-earth.kml+xml .kml
– AddType application/vnd.google-earth.kmz .kmz
• Add to web server• If using www.personal.psu.edu - create a
file named .htaccess in any subdirectory containing the .kml file
15
• Use Notepad, Dreamweaver, etc. to create a file with these 2 lines– AddType application/vnd.google-earth.kml+xml .kml– AddType application/vnd.google-earth.kmz .kmz
• Save with a name of .htaccess• Copy to a folder on ‘personal’
– The .htaccess file name is used for many things on an Apache web server. It will become ‘hidden’ when copied.
You may also experience problems attempting to name a file with only an extension (e.g. .htaccess). If so, give it a temp. name and then use the Portal to rename the file once it is in www.personal.psu.edu
16
Review of using .kml files
• Decide Google Earth / Google Maps• Get lat/long coordinates in decimal• Build .kml file with text editor
Google Earth w/.kml
• Build web page with link to .kmlfile
• Move both to web server• Add MIME types
– .htaccess if Apache web server
17
Google Maps and .kml
• Build web page with link to Google Maps–Link needs to contain some specific
code and the URL (web) address of the .kml file
Questions on Components and Process