我正在尝试整合 WebGL 链接:https ://sites.google.com/site/webgearth/
但是当我在浏览器中运行相同时,我收到了这个错误:
未捕获的语法错误:意外的令牌 '<'
api.js:1Uncaught ReferenceError: WE is not defined at initialize (index-new.html:7)
<!DOCTYPE HTML>
<html>
<head>
<script src="http://www.webglearth.com/v2/api.js"></script>
<script>
function initialize() {
var options = {
sky: true,
atmosphere: true,
zooming: true
};
var earth = new WE.map('earth_div',options);
WE.tileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',{
}).addTo(earth);
}
</script>
<style>
html, body{padding: 0; margin: 0;}
#earth_div{top: 0; right: 0; bottom: 0; left: 0; position: absolute !important;}
</style>
<title>WebGL Earth API: Hello World</title>
</head>
<body onload="initialize()">
<div id="earth_div"></div>
</body>
</html>
高度赞赏解决此问题的 Aby 解决方案