> root / 2008 / May / 28th

Radar points out that you can now get a 'Lite' (my word not theirs) version of Google Earth as a plug-in for IE and FF on Windows only (boo!), more information over here. Which is, you know great. More-so this is the really exciting part, for me anyway ...

Google Earth, as an application is hard to script and make-do-stuff(tm), a very cursory glance at the Google Earth Plugin shows a different story.

First, make sure you have Firefox with Firebug installed, or just follow along with me, with pictures.

Then go here (on Windows, blah blah) to see an example page. You'll probably have to install the plugin and restart the browser. A quick view of the source-code gives us a few hints as to what to do.

Open up the console in Firebug and type "ge" (without the quotes) to see what javascript thinks the "ge" object is, you'll probably get a line afterwards like this ...

[xpconnect wrapped (nslSupports, IKmlLookAt, IKmlAbstractView ...]

... clicking that line will expand the whole object into the Dom, which will look something like this (only more) ...

ge_explored.jpg

... See, see all the lovely methods! I generally find this (initially) a far more interesting way to discover what methods can be used etc. when playing with new stuff, especially as the API docs are normally not fully there right at the start. The one I'm particularly interest in is the "ge.createLookAt" method. Let's use that, again in the console type these 3 lines ...

var la = ge.createLookAt('');
la.set(51.503226, -0.118876, 100, ge.ALTITUDE_RELATIVE_TO_GROUND, 0, 0, 4000);
ge.getView().setAbstractView(la);

They will, in turn...

  1. Create a LookAt object
  2. Set the target of the look at object, in this case the London Eye, in London
  3. Tell Google Earth Plugin to set the view to the LookAt object

And that's it. Whoo!

Or you could, you know, use the specially built sandbox to play with the methods that Google have, but where's the fun in that?

Yes I know that's not much, but it's a damn site more scripting than I've been able to easily do with Google Earth the App. Of course this is only just touching the tip of the iceberg, and I'm sure we'll be seeing a number of more interesting examples come out over the next few days. I suspect the first few will just be laying KML files over the top, nice but dull =p. But hopefully after that we'll start to see more code where Javascript is controlling how the globe moves around to give the user a more semi-interactive experience.

Tie in a little Ajax and there's no good reason why at the very simplest you can't have one person controlling the view for several people sitting at different machines (and yes I know you can sort of do this with Network Links in Google Earth, or normal Maps, but this has a certain immersive element to it).

Taking us all slightly closer to Snowcrash :)

Oh, and here's a dump of the LookAt Object ...

lookat.jpg

... and this is the stuff I was typing into the console to test things out, where I got the location of the London Eye wrong at least twice!

console.jpg

Once more, I know this is all very trivial, but it makes me smile. Bring on the Google Earth Javascript games.



This is what used to be a blog, but is now an online diary/archive sort of thing. Below is a list of things you'll find for May 2008. As I'm laying off the twitter a bit and currently reclaiming all my Flickr photos this is the main place to find me, (subscribing via RSS) should still work.

I also have a podcast, with more audio experiments on SoundCloud. A smaller "scrapblog" is over on tumblr. If you need to get hold of me email hello@revdancatt.com

## Table of Contents: May


### More


> root / 2008 / May / 28th