controlling google earth with a controling application

441 Views Asked by At

If I were to write an application that controls another application which I don't have the binaries to,
For example, an application that by itself would open Google Earth and place the camera in a specific point my application would tell it, say -24,131, and then command google earth to save the image to a specific folder.

What is the approach to this? How can I know the functions that are being executed and fire them on behalf of a control program like that? Also, I will also need to know that downloading of images was finished so I can grab the image.

I saw there is an API for google earth, but I don't know if I can use it to control google-earth (the application itself)

1

There are 1 best solutions below

0
On

You can use the Google Earth API (developers.google.com/earth/) to control a Google Earth globe instance.

See Javascript code snapshot here:

var ge;

google.load("earth", "1");

function init() {
    google.earth.createInstance('map3d', initCB, failureCB);
    }
function initCB(instance) {
    ge = instance;
    ge.getWindow().setVisibility(true);
    ge.getOptions().setStatusBarVisibility(true);
    ge.getNavigationControl().setVisibility(ge.VISIBILITY_AUTO);
    ge.getLayerRoot().enableLayerById(ge.LAYER_BORDERS, true);
    ge.getLayerRoot().enableLayerById(ge.LAYER_ROADS, true);

    var lookAt = ge.createLookAt('');
    lookAt.setLatitude(41.26);
    lookAt.setLongitude(-100.00);
    lookAt.setRange(800000.0);
    ge.getView().setAbstractView(lookAt);
}

function failureCB(errorCode) {
    alert(errorCode);
}

    google.setOnLoadCallback(init);

See HTML code here:

<!DOCTYPE html>
<head>
    <script src="http://www.google.com/jsapi"></script>
</head>
    <style>
       body {
          margin:20px;
              height:100%;
          width:98%;
}
       #map3d {
          width:75%;
          float:right;
    }
</style>
<body>
  <div id="map3d"></div>
</body>
</html>

The you can use wkhtml2pdf (code.google.com/p/wkhtmltopdf/) function wkhtmltoimage, or PhantomJs (github.com/ariya/phantomjs/wiki/Screen-Capture) to get an image version.

Hope it helps!

Cheers, Mihai