thanksgiving-fun-with-kml

“I borrowed this code from NASA.” That comment received quite a laugh during one of my presentations. The comment was intended to be an acknowledgment that I did not create this code along with crediting the agency that did. Judging from the reaction, that is not how the line hit. At any rate, the irony of the statement is in how simple the code truly is. To me, coding fits well within the definition of geography I was taught…, “observe and analyze anything distributed across Earth’s space.” Learning to read and write KML is observing and analyzing spatial distributions. Granted the distribution is pixels on a screen and not Earth’s space, but the mental task is the same. Therefore, spatial reasoning, Google Earth, and NASA were part of the initial stepping stones in the creation of geteach.com.

imageoverlay

Keyhole Markup language (KML) is an open standard language used to display geographic data. KML is what Google Earth reads to show raster files (collocations of pixel that create an image…common form jpeg, png files. These images are often not geo-referenced with latitude and longitude coordinates) and vector files (points , lines, polygons, and multigeometry that are often geo-referenced). KML is a variant of XML (Extensible Markup Language) that includes geo-spatial language. Sorry for the jargon. that entire paragraph is just a fancy way of saying that kml is based off of a ubiquitous language that is easy to read and write.

The easiest way to write KML is through Google Earth. Whenever you add a placemark, line, polygon, or overlay Google Earth is writing code. However, sometimes you might want more precise control over these points, lines, polygons, and images. This is when you might want to edit your KML via any text editor. As a Windows user, I prefer Notepad++. Mac users can use TextWrangler, but I believe the company is moving users to BBEdit. If you are looking to collaborate on kml in the cloud you can use Google Drive and XML Editey. I taught my 8 year old html and css via Editey.

While KMLs can get extremely complicated, the aforementioned NASA code is about as simple as it gets. NASA Earth Observations is a great site to get environmental data about Earth. If you have visited geteach.com you will notice many of the datasets I use comes from NASA Earth Observations because it is free (make sure to pay your taxes) and open to use. Clicking around in NASA Earth Observations you will find out you can download Google Earth (KML) files of these datasets. Initially, these Google Earth files download as KMZ files. KMZ is a .zip version of a KML. Opening a .kmz in Google Earth and then saving the file as a .kml is equivalent to unzipping a .zip file. Basically, what the user downloads from NASA Earth Observations is a 3600 x 1800 image and a .kml file that wraps the image around the Earth. Fortunately for users, NASA uses the same map projection (WGS84) as Google Earth and Google Maps. Otherwise the locations of the image would not align with Google Earth.

Enough geo-spatial technology talk…it is time to impress your family and friends for 5 minutes after Thanksgiving dinner.
marioearth
Step 1: Take a family picture (If you are using a phone make sure you are shooting in landscape not portrait)
Step 2: Upload image to Google Drive and share “Anyone with a link can view” (This is going to complicate the code, but I prefer hosting images online)
Step 3: Code KML
Step 4: Save

Below is the breakdown of the code. Each snippet is highlighted followed by a brief description of how the code is being read. Feel free to copy/paste this kml code into your text editor of choice

<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2" xmlns:gx="http://www.google.com/kml/ext/2.2" xmlns:kml="http://www.opengis.net/kml/2.2" xmlns:atom="http://www.w3.org/2005/Atom">
	<Document>
		<name>Learning to Use 3D Printer</name>
		<LookAt>
			<longitude>0</longitude>
			<latitude>0</latitude>
			<altitude>0</altitude>
			<heading>0</heading>
			<tilt>0</tilt>
			<range>20770075.42761702</range>
		</LookAt>
		<GroundOverlay>
			<name>Learning to Use 3D Printer</name>
			<Icon>
				<href>https://drive.google.com/uc?view&amp;id=0B1eALoRda8FTdDlfTnVRSWpSclU</href>
			</Icon>
			<LatLonBox>
				<north>90</north>
				<south>-90</south>
				<east>180</east>
				<west>-180</west>
			</LatLonBox>
		</GroundOverlay>
	</Document>
</kml>

Line 1 tells Google Earth that this is an xml file with UTF-8 characters. This is similar to telling your browser which html version to use in reading the file.

<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2" xmlns:gx="http://www.google.com/kml/ext/2.2" xmlns:kml="http://www.opengis.net/kml/2.2" xmlns:atom="http://www.w3.org/2005/Atom">
	<Document>
		<name>Learning to Use 3D Printer</name>
		<LookAt>
			<longitude>0</longitude>
			<latitude>0</latitude>
			<altitude>0</altitude>
			<heading>0</heading>
			<tilt>0</tilt>
			<range>20770075.42761702</range>
		</LookAt>
		<GroundOverlay>
			<name>Learning to Use 3D Printer</name>
			<Icon>
				<href>https://drive.google.com/uc?view&amp;id=0B1eALoRda8FTdDlfTnVRSWpSclU</href>
			</Icon>
			<LatLonBox>
				<north>90</north>
				<south>-90</south>
				<east>180</east>
				<west>-180</west>
			</LatLonBox>
		</GroundOverlay>
	</Document>
</kml>

The highlights show an open (line 2) and closed (line 26) tag. Every open tag, with the exception of line 1, has to have a close tag. Notice the indented spacing of the file. Code is written like a Russian nested doll. Google Earth reads this as all tags between lines 2 and 26 will use the kml 2.2 standard.

<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2" xmlns:gx="http://www.google.com/kml/ext/2.2" xmlns:kml="http://www.opengis.net/kml/2.2" xmlns:atom="http://www.w3.org/2005/Atom">
	<Document>
		<name>Learning to Use 3D Printer</name>
		<LookAt>
			<longitude>0</longitude>
			<latitude>0</latitude>
			<altitude>0</altitude>
			<heading>0</heading>
			<tilt>0</tilt>
			<range>20770075.42761702</range>
		</LookAt>
		<GroundOverlay>
			<name>Learning to Use 3D Printer</name>
			<Icon>
				<href>https://drive.google.com/uc?view&amp;id=0B1eALoRda8FTdDlfTnVRSWpSclU</href>
			</Icon>
			<LatLonBox>
				<north>90</north>
				<south>-90</south>
				<east>180</east>
				<west>-180</west>
			</LatLonBox>
		</GroundOverlay>
	</Document>
</kml>

Lines 3 and 25 are the start and end of the visualization instructions…The container of the document.

<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2" xmlns:gx="http://www.google.com/kml/ext/2.2" xmlns:kml="http://www.opengis.net/kml/2.2" xmlns:atom="http://www.w3.org/2005/Atom">
	<Document>
		<name>Learning to Use 3D Printer</name>
		<LookAt>
			<longitude>0</longitude>
			<latitude>0</latitude>
			<altitude>0</altitude>
			<heading>0</heading>
			<tilt>0</tilt>
			<range>20770075.42761702</range>
		</LookAt>
		<GroundOverlay>
			<name>Learning to Use 3D Printer</name>
			<Icon>
				<href>https://drive.google.com/uc?view&amp;id=0B1eALoRda8FTdDlfTnVRSWpSclU</href>
			</Icon>
			<LatLonBox>
				<north>90</north>
				<south>-90</south>
				<east>180</east>
				<west>-180</west>
			</LatLonBox>
		</GroundOverlay>
	</Document>
</kml>

Line 4 is the name of the Google Earth file.

<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2" xmlns:gx="http://www.google.com/kml/ext/2.2" xmlns:kml="http://www.opengis.net/kml/2.2" xmlns:atom="http://www.w3.org/2005/Atom">
	<Document>
		<name>Learning to Use 3D Printer</name>
		<LookAt>
			<longitude>0</longitude>
			<latitude>0</latitude>
			<altitude>0</altitude>
			<heading>0</heading>
			<tilt>0</tilt>
			<range>20770075.42761702</range>
		</LookAt>
		<GroundOverlay>
			<name>Learning to Use 3D Printer</name>
			<Icon>
				<href>https://drive.google.com/uc?view&amp;id=0B1eALoRda8FTdDlfTnVRSWpSclU</href>
			</Icon>
			<LatLonBox>
				<north>90</north>
				<south>-90</south>
				<east>180</east>
				<west>-180</west>
			</LatLonBox>
		</GroundOverlay>
	</Document>
</kml>

Lines 5 through 12 are where the camera (Point of view) is pointed. Camera is pointed at 0° Longitude, 0° Latitude, 0 altitude (looks at the ground and not above ground), heading and tilt are are set to 0 (look straight down to the ground), and a range of 20770075.42761702 (camera’s distance from the ground)

<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2" xmlns:gx="http://www.google.com/kml/ext/2.2" xmlns:kml="http://www.opengis.net/kml/2.2" xmlns:atom="http://www.w3.org/2005/Atom">
	<Document>
		<name>Learning to Use 3D Printer</name>
		<LookAt>
			<longitude>0</longitude>
			<latitude>0</latitude>
			<altitude>0</altitude>
			<heading>0</heading>
			<tilt>0</tilt>
			<range>20770075.42761702</range>
		</LookAt>
		<GroundOverlay>
			<name>Learning to Use 3D Printer</name>
			<Icon>
				<href>https://drive.google.com/uc?view&amp;id=0B1eALoRda8FTdDlfTnVRSWpSclU</href>
			</Icon>
			<LatLonBox>
				<north>90</north>
				<south>-90</south>
				<east>180</east>
				<west>-180</west>
			</LatLonBox>
		</GroundOverlay>
	</Document>
</kml>

Between lines 13 and 24 <GroundOverlay> are the instructions on loading and positioning the image

<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2" xmlns:gx="http://www.google.com/kml/ext/2.2" xmlns:kml="http://www.opengis.net/kml/2.2" xmlns:atom="http://www.w3.org/2005/Atom">
	<Document>
		<name>Learning to Use 3D Printer</name>
		<LookAt>
			<longitude>0</longitude>
			<latitude>0</latitude>
			<altitude>0</altitude>
			<heading>0</heading>
			<tilt>0</tilt>
			<range>20770075.42761702</range>
		</LookAt>
		<GroundOverlay>
			<name>Learning to Use 3D Printer</name>
			<Icon>
				<href>https://drive.google.com/uc?view&amp;id=0B1eALoRda8FTdDlfTnVRSWpSclU</href>
			</Icon>
			<LatLonBox>
				<north>90</north>
				<south>-90</south>
				<east>180</east>
				<west>-180</west>
			</LatLonBox>
		</GroundOverlay>
	</Document>
</kml>

Line 14: The name of the image layer

<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2" xmlns:gx="http://www.google.com/kml/ext/2.2" xmlns:kml="http://www.opengis.net/kml/2.2" xmlns:atom="http://www.w3.org/2005/Atom">
	<Document>
		<name>Learning to Use 3D Printer</name>
		<LookAt>
			<longitude>0</longitude>
			<latitude>0</latitude>
			<altitude>0</altitude>
			<heading>0</heading>
			<tilt>0</tilt>
			<range>20770075.42761702</range>
		</LookAt>
		<GroundOverlay>
			<name>Learning to Use 3D Printer</name>
			<Icon>
				<href>https://drive.google.com/uc?view&amp;id=0B1eALoRda8FTdDlfTnVRSWpSclU</href>
			</Icon>
			<LatLonBox>
				<north>90</north>
				<south>-90</south>
				<east>180</east>
				<west>-180</west>
			</LatLonBox>
		</GroundOverlay>
	</Document>
</kml>

Between lines 15 and 17 <Icon> is the url for the image that you want to wrap around the Earth. <href> translates to file path or in this case…url. Replacing the url between the <href> tag with you own image and save will change your Earth. You can use a local file and save as a kmz later. Again, I am using the direct download link from Google Drive. This is different then the shared link. Explanation to how to get this link will follow.

<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2" xmlns:gx="http://www.google.com/kml/ext/2.2" xmlns:kml="http://www.opengis.net/kml/2.2" xmlns:atom="http://www.w3.org/2005/Atom">
	<Document>
		<name>Learning to Use 3D Printer</name>
		<LookAt>
			<longitude>0</longitude>
			<latitude>0</latitude>
			<altitude>0</altitude>
			<heading>0</heading>
			<tilt>0</tilt>
			<range>20770075.42761702</range>
		</LookAt>
		<GroundOverlay>
			<name>Learning to Use 3D Printer</name>
			<Icon>
				<href>https://drive.google.com/uc?view&amp;id=0B1eALoRda8FTdDlfTnVRSWpSclU</href>
			</Icon>
			<LatLonBox>
				<north>90</north>
				<south>-90</south>
				<east>180</east>
				<west>-180</west>
			</LatLonBox>
		</GroundOverlay>
	</Document>
</kml>

<LatLonBox> positions the image. The top of the image will be positioned at 90° north, the bottom 90° south, right side will be 180° east and left side will be positioned -180° west.

Again, if you would like to create your own picture Earth copy and paste the code below into your text editor and replace the name of the Google Earth file (line 4), the name of the images layer (line 14), and the url between <href> tags with your own image (line 16). If your image and kml are in the same folder on your PC you can just enter the file name (ex.image.jpg). Make sure to save as a kml in your text editor then open the file in Google Earth then save as a .kmz file before sharing. This will pack/zip the image and kml together. Uncheck all the layers in the lower left frame in Google Earth to turn off boundaries etc.

<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2" xmlns:gx="http://www.google.com/kml/ext/2.2" xmlns:kml="http://www.opengis.net/kml/2.2" xmlns:atom="http://www.w3.org/2005/Atom">
	<Document>
		<name>Learning to Use 3D Printer</name>
		<LookAt>
			<longitude>0</longitude>
			<latitude>0</latitude>
			<altitude>0</altitude>
			<heading>0</heading>
			<tilt>0</tilt>
			<range>20770075.42761702</range>
		</LookAt>
		<GroundOverlay>
			<name>Learning to Use 3D Printer</name>
			<Icon>
				<href>https://drive.google.com/uc?view&amp;id=0B1eALoRda8FTdDlfTnVRSWpSclU</href>
			</Icon>
			<LatLonBox>
				<north>90</north>
				<south>-90</south>
				<east>180</east>
				<west>-180</west>
			</LatLonBox>
		</GroundOverlay>
	</Document>
</kml>

How to use Google Drive to host your Google Earth images.
I am not sure how long this will work. Google has a habit of changing/discontinuing these things, but for now you can get a direct link to your uploaded files by modifying the shared url. All you do is take the Google Drive’s file ID and add it to this url: https://drive.google.com/uc?view&id=

Example:
Google Drive’s shared url: https://drive.google.com/open?id=0B1eALoRda8FTYnBGa1NfY1ZQa1E and/or https://drive.google.com/file/d/0B1eALoRda8FTYnBGa1NfY1ZQa1E/view?usp=sharing (this depends on which shared url you prefer to use)
Direct link: https://drive.google.com/uc?view&id=0B1eALoRda8FTYnBGa1NfY1ZQa1E

**Important** Because Google Earth uses xml, the “&” sign after “view” needs to be replaced by xml equivalent “&amp;”
Therefore the direct image link when coding kml via text editor is:https://drive.google.com/uc?view&amp;id=0B1eALoRda8FTYnBGa1NfY1ZQa1E (same url as above direct link replacing the “&” with “&amp;”)

Feel free to use this url converter created for my students if you have a number of images to convert (You will still have to manually replace “&” with “&amp;”)
http://geteach.com/staticstreet
Google Chrome Extension here: Link

ROYALTY FREE MUSIC by BENSOUND

mapping elections

I am attempting to stay apolitical here, but the digital “magic” map walls used by the media are totally inadequate and misrepresent the complexity and distribution of American citizens. How was that for an opening statement? There were plenty of lessons to be learned from last Tuesday’s election, but I woke up Wednesday looking at all the finalized digital maps thinking this country is in need for some geography and geo-spatial technology education.

cnnbattle
source: http://www.cnn.com/election/interactive-electoral-college-map/

It was very odd watching the pre-debate news shows on tv; CNN in particular. It was like watching ESPN’s College Game Day with Anderson Cooper and the panel staged outside with political fans holding signs behind them cheering on their favorite team…;I mean candidate. In general, I feel Americans are treated as a dichotomous society incapable of possessing more than two perspectives. However, as the pollsters and prognosticators are figuring out, the American people, and society, are much more complex than a blue and red map would suggest. And that is the point with this introduction: Geography is a perspective…. The geographical perspective provides a broadly applicable interdisciplinary method of observing and analyzing anything distributed across Earth’s space.

Honestly, I believe the news outlets understand this argument. However, it is difficult to tell a complicated narrative in the three to five minute news segment allotted. This is where good maps and geo-spatial technologies come in. Maps can convey an obscene amount of information in seconds. Yes, the pundits are needed to help interpret these data visualizations and critical thinking about reliability of sources and data by the consumers will be a necessity (see the need for geography education?), but it is time to go beyond two color maps and look into the quilt of American society.

Below are some examples of how media is visualizing the election results to the world. There is no way this event is this clear and clean…nothing in life is.

googleus
source: google search – “election results”

googlepenn
source: google search – “Pennsylvania election results”

And below is what a little high school geography teacher with some knowledge about geo-spatial technologies can do with free software and open data. Which map teaches up learners and which map(s) limits learning and critical thinking?

pennvote
Josh Williams – geteach.com (Full Size Image Here: http://geteach.com/blog/wp-content/uploads/2016/11/PennVote.png)

It really was not that tough to make…granted it took a day, but that is what it takes to clean up data. Below are the data sites and free geo-spatial technologies used to create this more complex tapestry of Pennsylvania. There is more data to pull and visualize, but this was start…a way to figure out my own misconceptions about American identity.

Technologies Used:
Google Earth Pro (Create KML files) – Link
Google’s My Maps (Converts Google Earth Pro KML to a KML file that the Maps API can read…ugly hack, but works) – Link
Qgis (Visualize and Create GIS files used to guide KML styling) – Link
LibreOffice (To clean data) – Link
Notepad++ (Not needed, but used to clean up KML styling: Windows Only / Mac alternative BBEdit) – Link Notepad++ | Link BBEdit

Data Sources:
Pennsylvania Spatial Data Access: http://www.pasda.psu.edu/ (Download County Boundaries – Almost every state has this…Census also has all the state counties https://www.census.gov/cgi-bin/geo/shapefiles/index.php)

Pennsylvania Department of State: http://www.electionreturns.pa.gov/ (Election Data)

KML Files:
If you have Google Earth on your computers you can download the below files from by Google Drive and explore using Google Earth.
If you are on Chromebooks you can import the files using the Google Drive URL into geteach.com and explore. See Video below.

Simple Colors KML (Blue and red based off on county winner): https://drive.google.com/open?id=0B1eALoRda8FTY0t6bDRVRkdOTEE
Complex Color KML (Range from blue to red based off of % of republican votes per county): https://drive.google.com/open?id=0B1eALoRda8FTX1p5UDFkRmpQVkU


ROYALTY FREE MUSIC by BENSOUND

hour of kml code

For the past four summers, I have had the fortune to present at Google’s Geo Teachers Institutes (GTI). At these GTIs, educators learn about varying Google Geo Tools (though I prefer services over tools) like Google’s My Maps, Google Earth, Earth Engine, StreetView/360 Imagery, Google Tour Builder, and more. My task this summer was to create an advanced session using kml. This assignment was in my wheelhouse. After all, learning kml was the stepping stone to creating geteach.com. Oddly enough this task was assigned around our school’s “hour of code” week. One of the coolest things about teaching geography is that every week has the potential for an hour of code. It was in this thinking that the “An Hour (ish) of KML Code” session was created. Sorry, this post is about to get real geeky, but geek is chic.

Purpose:
Coding with KML…an attempt to present through a blog. This is totally going to fail, but it will be fun to write.

Materials:
PC/Mac
Google Earth (For viewing our kml)
Google Drive (For hosting our kml)
XML Editey (Used for coding kml within Google Drive – You can use any text editor, but this drive addition makes life easy)
geteach.com/staticstreet (Taking Google Drive URL and turning it into a direct link)
Simple KML – Link
Package of patience (Trust me on this)

Why teach kml?
Keyhole Markup Language (kml) is an open standard language used by Google Earth to visualize geographic data sets. Because kml is an open standard, other platforms ie. ESRI, QGIS, OpenStreetMap, Leaflet, along with just about every GIS platform can read/render .kml files. Kml files are essentially XML files with the addition of a coordinate system (Latitude and Longitude). In short, kml files are easy to read and write…code.

How to Video: (Written Steps Below)

Steps:
1. Download Simple KML – Link
2. Upload Simple KML to your Google Drive
3. Set the “Simple.kml” share setting to anyone with a link
4. Copy/Paste “Simple.kml” share link into geteach.com/staticstreet input box
5. Then in geteach.com/staticstreet click “Get Link”
– The output link from geteach.com/staticstreet is a direct link to your kml.
6. Open Google Earth
7. Create Folder in Google Earth –> name it “Simple Network Link”
a. Click “Add”
b. Click “Folder”
8. Create Network Link
a. Click on “Simple Network Link” folder
b. Click “Add”
c. Click “Network Link”
d. Name Network Link
e. Copy output link from geteach.com/staticstreet and paste into Google Earth Network Link
f. Click “OK”
10. In Google Drive add Editey XML
11. In Google Drive open “Simple.kml” using Editey XML
12. Find id for “highlight”
13. Change size from 2.0 to 5.0 and….
icon url from “http://maps.google.com/mapfiles/kml/pushpin/ylw-pushpin.png” to “http://maps.google.com/mapfiles/kml/pushpin/red-pushpin.png”
14. In Google Earth refresh network link and mouse over pin.
a. Right Click Network link –> “refresh”
b. It takes about a minute for Google Drive to update saved files. I attempt to speed up this process by refreshing XML Editey,
but I don’t think that works. However, it helps to pass the time.

Congratulations if you made it this far! You are a Super Star!

Here is a link to Google’s KML reference library and endless opportunities – https://developers.google.com/kml/documentation/kmlreference

Happy Coding!

It has been a very busy three weeks for geteach.com

Wow! I have not had a three weeks like that in awhile. Fortunately, creating geteach.com has opened up professional development opportunities that I never thought, early in my teaching career, I would get. In the past three weeks, I have used cars, planes, trains, buses, and my own two feet to get from Austin to Mountain View, North Austin to South Austin, and Austin to Corpus Christi. During our district’s teacher professional development day my new principal presented his vision of professional development as, “a focus on continuous improvement” with, “individualized professional development.” My individualized professional development these past three weeks included a Top Contribute meetup at Google in Mountain View, an Austin area technology conference, a campus staff development, and finally a Texas social studies conference.

I feel so inspired listening to other teachers and professionals about their successes. In addition, I love sharing activities and lessons learned from my experiences. That stated, my ongoing inspiration for the past 10 months or so are the #worldgeochat every Tuesday night at 8:00 central.  This community if very welcoming that helps inspire, create new ideas, and gives me the opportunity to reflect on my own pedagogy.

There are many challenges in teaching these days. However, this is a great profession that I wish more could experience. As mentioned earlier this week, not all our lessons are great, or even good. But nothing is more rewarding, nothing gives greater joy than a lesson or unit that progresses the development of our students. Those days are the best and made possible by the professional experiences of the past and present.

 

**the 360 image above is me practicing my craft. Has little to do with the post…; just more for my own development.**

geteach.com – Climate Controls

Several weeks ago I mentioned how geteach.com became a project that got away from me. Here is video post demonstrating the lesson that kept me up night after night creating the site. Please feel free to take, modify, or recreate the lesson.

I understand that this lesson could very well be done with a good atlas; and originally, students used an atlas and paper. However, part of what makes technology a great tool for education is the ability to capture curiosity in a greater number of students.  If I can get a student to look at spatial distributions for an extra five minutes I’m all in. Granted there can be some downsides, like students jumping around the interweb never fully completing a thought, but hey…learning is messy.

Google Docs Lesson Template

Peter Spiegel’s Blog Post