I am getting an error when I use the Google Earth API. The error message is: ERR_CREATE_PLUGIN or in the browser google earth displays a message saying there has been an error with the plugin. I tried it in Chrome/Firefox/IE and have the same issue or complete whitespace where the google earth interface should be.
Now for my code, I would think my code is typical as per the tutorial on google's website. The primary difference is that I do not call it on page load. I have a bootstrap tab divdier that is loaded as a callback to another action. The map is loaded then. Through debugging the following code, I know that calling google.earth.createInstance results in a call to failureCB, but the error message is not very useful at all
function initCB(instance) {
var ge = instance;
var lookAt = ge.createLookAt('');
lookAt.setLatitude(lat);
lookAt.setLongitude(lng);
}
function failureCB(e, m) {
alert(e);
}
google.earth.createInstance('googleEarthTool', initCB, failureCB);
Any ideas on where I should go? Website at: http://beta.snowgeek.org/tools/trip-planning
The
ERR_CREATE_PLUGIN
issue is almost certainly to do with how you are loading the plug-in. You say......but you need to wait until the Google Earth Api has finished loading before you call
google.earth.createInstance
Typically this would be done via either
setOnLoadCallback
or else via theonLoad
handler for the document body, e.g.then...
google.setOnLoadCallback(init);
or
<body onload="init()">
EDIT
From looking at your code I can't see that you ever call
ge.getWindow().setVisibility(true);
To actually display the plugin - surly you would need to do something like
Also, there is an error in how you are loading the api.
google.load("earth", "1", { "other_params" : "sensor={true_or_false}" });
Should be
google.load("earth", "1", { "other_params" : "sensor=true" });
or
google.load("earth", "1", { "other_params" : "sensor=false" });