据我了解,没有机会将 3D 对象添加到 Google 地球中,因此该仪器还提供了在本地 GE 中添加对象的机会(?)。我们正在寻找什么。我们尝试从官方页面做一些示例,但没有成功添加精确的 3D 对象并将其放置在所需的坐标中。我的问题是:
- 拥有 GE 插件是否足以拥有 GE 的本地版本或我们到底需要什么?
- 是否真的可以将 3D 对象添加到 GE 本地插件?
- 如何使用所需坐标运行此示例(大约长:51.02 纬度:71.08)?
- 如果需要添加 .dae 文件,如何更改它们的位置坐标?
这是带有 JS 脚本 ( kmz-file ) 的完整 html 文件:
<!--
You are free to copy and use this sample in accordance with the terms of the
Apache license (http://www.apache.org/licenses/LICENSE-2.0.html)
-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<title>Google Earth API Sample</title>
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript">
var ge;
google.load("earth", "1");
function init() {
google.earth.createInstance('map3d', initCallback, failureCallback);
}
function initCallback(pluginInstance) {
ge = pluginInstance;
ge.getWindow().setVisibility(true);
// add a navigation control
ge.getNavigationControl().setVisibility(ge.VISIBILITY_AUTO);
// add some layers
ge.getLayerRoot().enableLayerById(ge.LAYER_BORDERS, true);
ge.getLayerRoot().enableLayerById(ge.LAYER_ROADS, true);
// just for debugging purposes
document.getElementById('installed-plugin-version').innerHTML =
ge.getPluginVersion().toString();
var href = 'The_Pentagon.kmz';
//var href = 'http://localhost/Users/k.bazaraly/Desktop/GoogleEarthTest/kml_example.kml';
google.earth.fetchKml(ge, href, function(kmlObject) {
if (kmlObject)
ge.getFeatures().appendChild(kmlObject);
if (kmlObject.getAbstractView() !== null)
ge.getView().setAbstractView(kmlObject.getAbstractView());
});
}
function failureCallback(errorCode) {
}
</script>
</head>
<body onload="init()" style="font-family: arial, sans-serif; font-size: 13px; border: 0;">
<div id="map3d" style="width: 500px; height: 380px;"></div>
<br>
<div>Installed Plugin Version: <span id="installed-plugin-version" style="font-weight: bold;">Loading...</span></div>
</body>
</html>