Home  >  

Geo-Blogging with the Google Earth API

Author photo
| | Comments (5)
AddThis Social Bookmark Button
A belated happy holidays and happy new year to everyone! This year I received a gift that I feel compelled to write about... I hope that anyone else who is both a computer and map nerd will appreciate it.

Now, the concept Geo-tagging data is not new. With GPS and cellular-network based geolocation available nearly everywhere, geographic information is showing up everywhere that it is applicable; cell phones, web sites, rss feeds, etc... It is the backbone of the "geoweb". There are numerous programs for geotagging your data, and you can even geotag your pictures from your iPhone, if you so choose.

trackstick.jpg
With that out of the way, let's get into what I find to be very interesting. The gift I mentioned earlier is a Trackstick II (see picture). It is a portable device (about 4.5 inches x 1 inch x 1/2 inch) that looks like an oversized USB-thumb drive. You take it with you, and it will track your geographic position (latitude, longitude, & altitude) and the time you were at that location over a period of time. If you are into hiking, or just tracking where you've been, then this is quite an interesting gadget.

The Trackstick comes with software for geo-tagging your photos based on timestamps. You can embed the geolocation information directly in the image metadata, or you you can export KMZ files that can be imported with Google Earth.

Now, this is where I got intrigued... If you can view the exported KMZ in Google Earth, what's stopping you from using that same exported data in the Google Earth browser plugin?

Well, nothing is stopping you. You can view this information directly in the browser using the Google Earth browser plugin. It works on both Mac and Windows, in most browsers (see the Google Earth API documentation for a list of supported browsers).

Below you can see a sample of the output. This is the record of a New Year's fishing trip with my brother and brother-in-law. I'm the one in the red jacket. None of the fish were big enough to keep, but it was a fun outing nonetheless.

screenshot.jpg

Or, you can directly interact with the KMZ output and browser plugin here:
http://www.tricedesigns.com/portfolio/geoblog/2009.01.01/

Or, load the KMZ in Google Earth here (must have Google Earth installed):
http://www.tricedesigns.com/portfolio/geoblog/2009.01.01/fishing_geoblog.kmz

I like to refer to it as Geo-blogging, for lack of a better term. It shows where I went on the trip and documents when and where pictures were taken. If you click on an image, it will show additional details about when and where that specific picture was taken.

Loading the KMZ file is easy. I started with the code from my previous blog post on Exploring the Google Earth API, and just started ripping out everything that I didn't need. You can see the full HTML source code below. Basically, all that it does is instantiate the Google Earth browser plugin, and then use a networkLink object to load the KMZ file.

A KMZ file is basically a zip archive containing a KML markup file and any other assets that you want embedded in it. When the KMZ is exported from the Trackstick Manager software, the thumbnail images and full-size images are embedded within it. To reduce load time in the browser, I removed the full-size images from the archive and linked them to the images on the server. I also got rid of some of the extraneous KML markup that cluttered the display. I left it as simply the images with their clickable descriptions, and the red outline of the driven path.

Full HTML Source:
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>Fishing Geo-blog</title>
<script type="text/javascript" src="http://www.google.com/jsapi?key=ENTER_API_KEY_HERE"></script>
<script type="text/javascript">
google.load("earth", "1");
google.load("maps", "2.99");  

var ge = null;
var geocoder;
var _position = [0,0,0,0];

function init() {
 	geocoder = new GClientGeocoder();
 	google.earth.createInstance("map3d", initCB, failureCB);
}

function initCB(object) {
 	ge = object;
 	ge.getWindow().setVisibility(true);
 
 	var networkLink = ge.createNetworkLink("");
 	networkLink.setFlyToView(true);
 	var link = ge.createLink("");
 
 	link.setHref( "http://www.tricedesigns.com/portfolio/geoblog/2009.01.01/fishing_geoblog.kmz?cachebuster=" + Math.random() );
 	networkLink.setLink(link);
 	ge.getFeatures().appendChild(networkLink);
 
 	ge.getNavigationControl().setVisibility(ge.VISIBILITY_SHOW);
}

function failureCB(object) {
   alert('load failed');
}
</script>
<style type="text/css">
<!--
body {
 	margin-left: 0px;
 	margin-top: 0px;
 	margin-right: 0px;
 	margin-bottom: 0px;
}
-->
</style></head>

<body onload='init()' id='body' scroll="no">

	<div id='map3d_container' style="position:absolute;;border:0px;width:100%;height:100%;">
		<div id='map3d' style='width:100%;height:100%;'></div>
	</div>

</body>
</html>


___________________________________
Andrew Trice
Principal Architect
Cynergy Systems
http://www.cynergysystems.com

Read more from Andrew Trice. Andrew Trice's Atom feed

Comments

5 Comments

Satish said:

Hey, th's damn cool.

ryan said:

Andrew Powell wrote a sweet blog post how to access Garmin GPS data using AIR Flex, Java and Merapi...

check it out: http://www.infoaccelerator.net/blog/post.cfm/live-gps-visualizations-with-air-merapi

thanks for this article i personally believe that everybody should get geocaching and jump on board!!! the more data the better...

Helen said:

Andrew, after looking at the trackstick web site, are you sure the gift buyer doesn't ulterior motives for buying you it?

:-)

zhok said:

You can find some of the most amazing places caught from google earth at
http://www.caughtfromabove.com
Hope you enjoy ;)

Ivan said:

This was great help!
thanks.

Leave a comment


Type the characters you see in the picture above.

Tag Cloud

Poll: Sci-Fi Movies

What's Your Favorite Sci-Fi Movie of All Time?

Vote | View Poll Results | Read Related Blog Entry

Latest Features

  •     Welcome back to the series. This time we are goings to build a really exciting component that will be used to simply display information about the user. Well, you might say why to we need such a component, is there... Continue Reading
  •    Welcome back to our exciting Facebook ActionScript series. In this article we will discuss one of most important (and most exciting) features of the FB platform, it's the publishing of news. We all know when we log in to facebook,... Continue Reading
  • This article provides 10 tips and best practices (in no particular order) for maximizing the benefits that Dojo can bring to your next project. For a more thorough introduction to Dojo, see the article Dojo: The JavaScript Toolkit with... Continue Reading
  •     The notifications are one of the most interesting (and important) parts of the facebook area. In order to completely understand the Flash side of it, we need to understand the basics of the facebook notification, what it is and how... Continue Reading

Development Series

Get an overview of the tools and technologies that work together to allow developers to build Rich Internet Applications (RIAs) quickly and easily.

facebook icon Facebook Application Development

Anatomy of an Enterprise Flex RIA

Recommended for You

@InsideRIA on Twitter

Archives

  • Or, visit our complete archive.  

About This Site

Welcome to the premiere community site for all things RIA sponsored by O'Reilly Media and Adobe Systems Incorporated.