Apr 29, 2011

Control Google Earth from Manipulate

One reader asks: could one drive Google Earth from a set of controls within a Manipulate? The answer is yes, however, I only know how to do it with Windows platform through Google Earth COM API. In the past, this issue is covered in this post: Control Google Earth from Mathematica.

The example here is very simple, rotate the camera from Manipulate.

Needs["NETLink`"]
InstallNET[];
(* start up goolge earth *)
ge = CreateCOMObject["GoogleEarth.ApplicationGE"];
(* get the camera object *)
cam = ge@GetCamera[0]
(* define a function to rotate the camera *)
runcam[{lat_, lon_}] := Module[{},
   cam@FocusPointLongitude = lon;
   cam@FocusPointLatitude = lat;
   ge@SetCamera[cam, 2]];

Manipulate[
runcam[{lat, lon}]; {lat, lon}, {lat, -50, 50}, {lon, -180, 180}]

googleearthcontrol

4 comments:

Anonymous said...

Hello;

When I run your code, using 8.0.01 Mathematica, on windows 7, I get this error

CreateCOMObject::netexcptn: A .NET exception occurred: {At Line = 122, the input was:,ge=CreateCOMObject[GoogleEarth.ApplicationGE];,System.Runtime.InteropServices.COMExcep\[Ellipsis] cketHandler.createCOM(KernelLinkImpl ml)}. >>


do you know how to fix it?

thanks
steve

Anonymous said...

Sorry, no idea on this issue.

Anonymous said...

same error here...

Anonymous said...

This is great stuff. Keep going, more, more, more! What other sites do you have? I see theres no way to contact you; shame. I think you might be just who Im looking for...if you see this please email me:
info-AT-typosaur.us

Im not trying to sound ominous or creepy. ; )