在浏览器中加载googleEarth插件
(1) 首先,需要下载google Earth插件,并正确安装。
下载地址:http://www.google.com/earth/explore/products/plugin.html
-----
(2) 编写如下HTML代码(其中含加载GoogleEarth的JS代码)
更多地开发请参考:http://code.google.com/apis/earth/documentation/
<html>
<head>
<title>Sample</title>
<script src="http://www.google.com/jsapi?key="Write your key here"> </script>
<script type="text/javascript">
var ge;
google.load("earth", "1");
function init() {
google.earth.createInstance('map3d', initCB, failureCB);
}
function initCB(instance) {
ge = instance;
ge.getWindow().setVisibility(true);
ge.getNavigationControl().setVisibility(ge.VISIBILITY_AUTO);
ge.getLayerRoot().enableLayerById(ge.LAYER_BORDERS, true);
ge.getLayerRoot().enableLayerById(ge.LAYER_ROADS, true);
}
function failureCB(errorCode) {
}
google.setOnLoadCallback(init);
</script>
</head>
<body>
<div id="map3d" style="height: 400px; width: 600px;"></div>
</body>
</html>
-----
(3) 最后,使用Chrome打开该html文件,效果图如下:

浙公网安备 33010602011771号