var kmlUrl = "http://www.fraserchapman.co.uk/kml/test2.kml"; // test kml
google.load('earth', '1.x', {
'callback': function () {
google.earth.createInstance('map3d', function (plugin) {
plugin.getWindow().setVisibility(true); // display the plugin
var gex = new GEarthExtensions(plugin); // initialise the extensions
gex.util.displayKml(kmlUrl); // load some kml
kmlCommands.init(gex); // run the kml commands (see below)
}, function (error) {
alert(error); // plugin error
});
}
});
/*
kmlCommands needs to be passed an instance of GEarthExtensions to work with. e.g.
var gex = new GEarthExtensions(ge);
kmlCommands.init(gex);
kmlCommands also accepts various options allowing one to control the behaviour:
'gex' : GEarthExtensions instance (required)
'element' : DOM element that contains the links you with to modify (default document)
'unsafe' : If true disables content scrubbing (default false)
'ge' : GEPlugin instance (default GEarthExtensions.pluginInstance)
e.g.
// use a specific target
var element = document.getElementById("someElement");
kmlCommands.init('gex': gex, 'element': element);
// disable content scrubbing
kmlCommands.init('gex': gex, 'unsafe': true);
*/
;(function (module, window, undefined) {
var gex = null,
unsafe = false,
element = window,
command = {
flyto: function (f) {
this.gex.util.flyToObject(f, {
boundsFallback: true
});
return f;
},
balloon: function (f) {
var c = this.unsafe ? f.getBalloonHtmlUnsafe() : f.getBalloonHtml(),
b = this.gex.pluginInstance.createHtmlStringBalloon('');
b.setFeature(f);
b.setContentString(c);
this.gex.pluginInstance.setBalloon(b);
return f;
},
balloonflyto: function...
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Fiddle Pages
Your fiddles accessible under a custom domain and a vanity path - the simplest hosting for your personal project.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Get Fiddle Pages with PRO
Your fiddles accessible under a custom domain and a vanity path - the simplest hosting for your personal project.