Make your KML Flash-y!

Tuesday, October 23, 2007 at 3:30:00 PM

The recent Google Earth 4.2 release added the ability to view Flash content, in Windows versions of Earth. This is great news for KML authors, especially given how easy it is to include Flash in your info bubbles. All you have to do is use the param and embed tags, just as if you were embedding it in a normal webpage. I was looking at one of the youtube videos from the Google Earth Outreach team, and noticed the "Embed" text box. I selected, copied and pasted, and got this:

<object width="425" height="350">
<param name="movie" value="http://www.youtube.com/v/5LzPw8-CGdA"></param>
<param name="wmode" value="transparent"></param>
<embed src="http://www.youtube.com/v/5LzPw8-CGdA"
type="application/x-shockwave-flash" wmode="transparent" 
width="425" height="350"></embed></object>

After putting that code directly in the description element of a KML Placemark and decreasing the width and height a bit, I got this:

<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://earth.google.com/kml/2.2">
 <Placemark>
  <name>Declan Butler's Avian Flu Outbreaks in Google Earth</name>
  <description><![CDATA[
<object width="240" height="200">
<param name="movie" value="http://www.youtube.com/v/_N805-TyUiY"></param>
<param name="wmode" value="transparent"></param>
<embed src="http://www.youtube.com/v/_N805-TyUiY"
type="application/x-shockwave-flash" wmode="transparent" width="240"
height="200"></embed></object>]]>
</description>
  <LookAt>
   <longitude>101.5513816532019</longitude>
   <latitude>13.65113039555518</latitude>
   <altitude>0</altitude>
   <range>3571781.303404128</range>
   <tilt>0</tilt>
   <heading>10.18456659033348</heading>
   <altitudeMode>relativeToGround</altitudeMode>
  </LookAt>
    <Point>
   <coordinates>100.3689268271656,15.74695793086107,0</coordinates>
  </Point>
  </Placemark>
</kml>

Here's what this looks like in Earth - a nice description balloon with an embedded YouTube video:

And this works just the same on Maps too. Here's what it looks like in a Maps API map:

But video isn't all you can do - any Flash application can be embedded. Google Earth Hacks allows you to view and post to their forums from within their info bubbles, and Valery Hronusov puts a Meebo chat room in his.