Tuesday, January 03, 2006

Update on Controlling GoogleEarth from JScript

It seems that Google have updated their APIs in the newer versions of GoogleEarth. However, the changes make the code I wrote in Controlling GoogleEarth from JScript even simpler:


<html>
<head>
<script>
function moveToCoordinates(lat, long)
{
try
{
googleEarth.setViewParams(lat,lon,1000,45,0,0,0.2);
}
catch (e)
{
alert(e.description);
}
}
</script>
</head>
<body>
<object
classid="clsid:AFD07A5E-3E20-4D77-825C-2F6D1A50BE5B"
id="googleEarth"
>
</object>
<button
onclick="moveToCoordinates(51.5256937588635, -3.20453415360346)"
>
Go To Steve's House
</button>
</body>
</html>



(Note that may need to enable ActiveX controls to get this to work. You'll also need to have Google Earth installed, and it might not work with nonIE browsers)

It seems that Google have updated their APIs in the newer versions of GoogleEarth. However, the changes make the code I wrote in Controlling GoogleEarth from JScript even simpler:

(Note that may need to enable ActiveX controls to get this to work. You'll also need to have Google Earth installed, and it might not work with nonIE browsers)


<html>
<head>
<script>
function moveToCoordinates(lat, long)
{
try
{
googleEarth.setViewParams(lat,lon,1000,45,0,0,0.2);
}
catch (e)
{
alert(e.description);
}
}
</script>
</head>
<body>
<object
classid="clsid:AFD07A5E-3E20-4D77-825C-2F6D1A50BE5B"
id="googleEarth"
>
</object>
<button
onclick="moveToCoordinates(51.5256937588635, -3.20453415360346)"
>
Go To Steve's House
</button>
</body>
</html>