我未能成功地显示我的侧数据库(Mapsengine/Earthbuilder中的地图)。我已经安装了Google插件,并试图从Firefox、Chrome和IE浏览器上访问它,但似乎没有任何东西有效。我不知道我做错了什么,因为我已经用谷歌代码游乐场中使用的代码确认了我的代码,并且我尝试了一种解决方法,这是在过去的一个类似问题中提出的(问题21: GMaps引擎层在GEarth插件上消失了)。当指定要用GE插件显示的地图的URL时,我甚至将URL更改为包含&export=download,这是我在另一个类似问题上看到的修复方法之一(它是关于google中的kml文件)。
奇怪的是,当我的网页被访问时,它不会出现侧数据库无法下载的错误。我已经包含了下面代码的一部分。
如能提供任何协助,将不胜感激。
提前谢谢你,
<script type="text/javascript">
var CHO;
google.load("earth", "1");
function init() {
google.earth.createInstance('map3d', initCB, failureCB);
}
function initCB(instance) {
CHO = instance;
CHO.getWindow().setVisibility(true);
CHO.getNavigationControl().setVisibility(CHO.VISIBILITY_AUTO);
CHO.getLayerRoot().enableLayerById(CHO.LAYER_BORDERS, true);
CHO.getLayerRoot().enableLayerById(CHO.LAYER_ROADS, true);
addSideDatabase()
// Add controls for the window
CHO.getOptions().setStatusBarVisibility(true);
CHO.getNavigationControl().setVisibility(CHO.VISIBILITY_AUTO);
// Update the view in Google Earth
var lookAt = CHO.createLookAt('');
lookAt.setLatitude(30.0);
lookAt.setLongitude(-90.0);
lookAt.setRange(9500000); //default is 0.0
CHO.getView().setAbstractView(lookAt);
}
function failureCB(errorCode) {
alert(errorCode);
}
function sideDatabaseSuccess(db) {
sideDatabase = db;
db.setDrawOrder(2);
}
function sideDatabaseFail() {
alert('Sorry! Side database failed to load!');
}
/** Add the URL for the globe served by Earth Enterprise or Earth Builder.
* This function operates similarly to the File => Add Database feature
* in Google Earth EC.
*/
function addSideDatabase() {
google.earth.addSideDatabase(
CHO, "https://mapsengine.google.com/map/edit?mid=zHgXRX6Mts2Q.kHGFoYZlcyBQ&export=download",
sideDatabaseSuccess,
sideDatabaseFail,
{
userName: '',
password: ''
}
);
}google.setOnLoadCallback(init);</script> 发布于 2013-05-09 01:45:35
你要装的东西是地图,不是地球仪。两者是不对等的。你不能在谷歌地球上加载地图。
好的一面是,你的侧面加载代码是正点的。用http://laearth.la.gov (路易斯安那州的自定义谷歌地球服务器)替换你的网址,它就能工作了。
发布于 2013-08-16 12:01:49
这是谷歌地图引擎Lite地图的URL吗?如果是这样的话,这可能就是问题所在。我刚刚尝试在谷歌代码游乐场示例中使用的URL (https://earthbuilder.google.com/10446176163891957399-13516001307527776624-4/kh/)交换,这里是database。但是我的Google引擎Lite没有,而且,它甚至没有调用它的成功或失败回调函数!
https://stackoverflow.com/questions/16446410
复制相似问题