我一直无法成功显示我的边数据库(来自Mapsengine/Earthbuilder的地图)。我安装了谷歌插件,并试图从Firefox,Chrome和IE浏览器访问它,似乎没有任何工作。我不确定我做错了什么,因为我已经使用Google Codeground Playground中使用的代码确认了我的代码,并且我尝试了一个与过去类似的问题中提出的解决方法(问题21:GMaps引擎层消失GEarth插件)。在指定要在GE插件中显示的地图的URL时,我甚至将URL更改为包含& export = download,这是我在另一个类似问题(它是关于来自Google文档的kml文件)中看到的修复之一。Google地球插件未从Mapsengine/Earthbuilder加载sideDatabase
奇怪的是,当我的网页被访问时,它不会给出侧数据库无法下载的错误。 我已经包含下面的部分代码。
任何援助将不胜感激。
由于提前,
<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>
嗨Debracey,谢谢你回答我的问题。我的目标是将地图作为Google地球插件中的一个图层加载,并且我通过Google地球插件文档(https://developers.google.com/earth/documentation/)了解了此插件功能,其中特别提到Google Maps Engine地图可以加载到GE插件中。我遵循Google关于如何完成这项任务的指示,但它从未正常工作。 – Semir 2013-05-12 16:01:30
嗯好吧 - 所以它可能工作。尽管他们使用的URL非常不同。您是否尝试过https:// mapsengine.google.com/map/zHgXRX6Mts2Q.kHGFoYZlcyBQ/kh /'?注意他们使用earthbuilder,而不是mapsengine。不知道这是如何发挥作用。 – debracey 2013-05-12 18:21:08
是的,我使用了mapsengine网址,但没有奏效。我认为earthbuilder是mapsengine的早期版本。如果您尝试访问earthbuilder.google.com,它会将您带到地图引擎。除此之外,通过谷歌文档,该网站应该工作(即在GE插件中下载的地图图层),但它并没有,这导致我相信Google可能会出现问题,如果是这样的话,那么我很惊讶,我没有看到更多像我发布的问题。 – Semir 2013-05-13 14:22:43