April 10th, 2009 | Published in Google Maps
If you're reading this blog, there's a good chance that you've seen or made some awesome geographic data visualizations in KML. Which means you know all too well that it can be hard to grasp the full story behind a visualization, especially a 3D visualization, without being guided through it. If you're like me, you might even have created KML files with giant Placemarks labeled "Start Here" and "Now go Here" and "Great View -- click on me!" If you're like me, you also felt dirty after doing that. It feels kind of like writing Perl -- you do it sometimes, but you don't really like to talk about it.
With the launch of Google Earth 5.0, we tackled this problem by introducing the ability to record and play your own tours through the world. Tours are a bit like interactive videos inside of Google Earth. Like a video, you can guide people on narrated journeys around the world and through your data, and you can rewind and fast forward. But when you pause a tour, unlike video, you can wander around in 3D. We included a shiny user interface for creating simple tours from inside of Google Earth 5.0, but underneath the hood tours are encoded as a powerful set of extensions to the KML language, that are much more expressive than the current recording functionality in Google Earth 5.0. In brief, these KML elements specify the timeline of the tour... a sequence of actions that tells Google Earth how to move the user through the world. They also allow you to modify and interact with your data presentation. In developing this language, we wanted to give developers precise control over all aspects of a tour. Not only can you control the movement of the camera, but you can play sound files, pop open info balloons, toggle the visibility of features, manipulate the time slider, and even animate the position and styling of content.
Below is a snippet of an example KML file containing a placemark and a tour. In the tour, the camera first flies to a good viewing location for the placemark and opens the placemark's info balloon for a few seconds. Then it closes the balloon, and proceeds to animate the size of the placemark icon and the color of the label using the <gx:AnimatedUpdate> action. It's an easy-to-read example for KML developers, but don't expect it to win an Oscar any time soon. On the other hand, it does show off the structure of a basic tour
... see full file for the entire example ... <!-- Our tour. The Playlist inside contains the sequence of actions that compose the tour. --> <gx:Tour> <name>Example Tour</name> <gx:Playlist> <!-- Fly to the view of the placemark in 5.2 seconds. --> <gx:FlyTo> <gx:flyToMode>bounce</gx:flyToMode> <gx:duration>5.2</gx:duration> <LookAt> <longitude>-78.19074499027175</longitude> <latitude>35.31730443852049</latitude> <altitude>0</altitude> <range>10704.41142132794</range> <tilt>58.57687432675979</tilt> <heading>-76.75532143327891</heading> <altitudeMode>relativeToGround</altitudeMode> </LookAt> </gx:FlyTo> <!-- Open the balloon of the placemark. --> <gx:AnimatedUpdate> <gx:duration>0.0</gx:duration> <Update> <targetHref/> <!-- Left empty to refer to the current file --> <Change> <Placemark targetid="pm1"> <gx:balloonVisibility>1</gx:balloonVisibility> </Placemark> </Change> </Update> </gx:AnimatedUpdate> ... and so on ...To get started learning the language, you can make tours in Google Earth and save them as KML, reading the source for inspiration. Or you can dive straight into our KML developer tutorial for touring. If you're planning on generating tours programmatically, be sure to check out our open source KML parsing and generating library, which added full support for reading and writing Touring KML on the same day that Google Earth 5.0 came out.
Additionally, we recently released tour support in the Google Earth Plugin version 5.0. With this, it's now easy to integrate cinematic Google Earth presentations directly into your web content, complete with sound! See the plugin tour API example for details. Or check out the new tour gallery and touring gadget for more examples and techniques for putting tours into web pages.
Tours can be as long and as complicated as you want, so just let creativity be your guide in telling your story. Whether you're following GPS traces, modeling the ocean currents, mapping city population over time, or simply showing the good restaurants in your neighborhood, if you're serious about sharing your geo-data with the world, consider making some tours to accompany your KML file. You already have great visualizations lying around, so now show them off in style with a tour!