The easiest way how to embed a 3D globe in any webpage. Simple but still very powerful API. No plugin needed.
To learn how to use WebGL Earth JavaScript API please see a simple example:
The "Hello World"
<!DOCTYPE HTML><html><head><script src="http://www.webglearth.com/api.js"></script><script> function initialize() { var options = { zoom: 3.0, position: [47.19537,8.524404] }; var earth = new WebGLEarth('earth_div', options); }</script></head><body onload="initialize()"> <h1>WebGL Earth API: Hello World</h1> <div id="earth_div" style="width:600px;height:400px;border:1px solid gray; padding:2px;"></div></body></html>Try the live version: helloworld.html
As you see, first you need to load the WebGL Earth API from
http://www.webglearth.com/api.js.You choose an HTML container (the <div> element typically) - to embed the earth to. Finally you call the initialization of the object
WebGLEarth('earth_div') from JavaScript - to display the Earth inside of the provided div element.Please check the other examples of the JavaScript API on the right side of this page. Feel free to copy&paste any of these and start to create something cool! And let us know at the mailing-list. ;-)
JavaScript API ReferenceIn this moment the JavaScript API is pretty simple, but it will grow in the future. Review the list of available methods:
WebGLEarth object
Constructor
Methods
WebGLEarth.Map object
This object can be constructed via
WebGLEarth.initMap() method.
WebGLEarth.Marker object
This object can be constructed via
WebGLEarth.initMarker() method.
|






