从我的网站加载 Google Earth API 时,我有一个设置视图开始,但它从空间开始,然后放大,而不是从这个放大的视图开始。这对观众来说很奇怪,特别是因为我的观点是从北向南看,所以地球在进入的过程中旋转:http: //www.colorado.edu/geography/cartpro/cartography2/fall2011/bartel/projects/ project3_tungurahua/tungurahua_hazards.html
地图加载到 iframe 中。我也想在不更改缩放视图的情况下在各种 kmls 之间切换,但我会单独发布这个问题。我环顾四周寻找答案,但没有找到任何具体的信息——如果我错过了关于这个的帖子,我很乐意检查一下是否有人能指出我正确的方向。
这是代码:
var ge;
google.load("earth", "1");
function init() {
google.earth.createInstance('map3d', initCB, failureCB);
}
function initCB(instance) {
ge = instance;
ge.getWindow().setVisibility(true);
// set navigation controls
ge.getNavigationControl().setVisibility(ge.VISIBILITY_AUTO);
// to fetch a KML file and show it
function finished(object) {
if (!object) {
// wrap alerts in API callbacks and event handlers
// in a setTimeout to prevent deadlock in some browsers
setTimeout(function() {
alert('Bad or null KML.');
}, 0);
return;
}
ge.getFeatures().appendChild(object);
var la = ge.createLookAt('');
la.set(-1.251336, -78.443817, 7000, ge.ALTITUDE_RELATIVE_TO_GROUND,
177, 65, 500);
ge.getView().setAbstractView(la);
}
//var marker = new GMarker(new GLatLng(-1.402002,-78.409471)); // latitude, longitude
// map.addOverlay(marker);
function failureCB(errorCode) {
}
google.setOnLoadCallback(init);
谢谢!!