我一直無法成功顯示我的邊數據庫(來自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