2013-09-26 33 views
0

在源我跑的MapQuest的示例代碼:什麼是地圖圖像的MapQuest的JavaScript的API

MQA.EventUtil.observe(window, 'load', function() { 
/*Create an object for options*/ 
var options={ 
    elt:document.getElementById('map'),  /*ID of element on the page where you want the map added*/ 
    zoom:10,         /*initial zoom level of the map*/ 
    latLng:{lat:39.743943, lng:-105.020089}, /*center of map in latitude/longitude */ 
    mtype:'map',        /*map type (map)*/ 
    bestFitMargin:0,       /*margin offset from the map viewport when applying a bestfit on shapes*/ 
    zoomOnDoubleClick:true     /*zoom in when double-clicking on map*/ 
}; 

/*Construct an instance of MQA.TileMap with the options object*/ 
window.map = new MQA.TileMap(options); 
}); 

和生成的地圖確定。但看着生成的HTML,目前還不清楚地圖數據的來源。我期待可能是iFrame或圖像,但我沒有看到:

<div id="map" style="width: 800px; height: 300px; position: relative;"> 
<div style="width: 800px; height: 300px; z-index: 0; overflow: hidden; background: none repeat scroll 0% 0% rgb(255, 255, 255); position: relative; top: 0px; left: 0px; cursor: -moz-grab;"> 
<div class="mqa-display" style="position: absolute; z-index: 0;"> 
<div class="mqa-zl mqa-zl100 mqa-zlf" style="position: absolute; z-index: 100; cursor: default;"> 
<div class="mqa-zl mqa-zl0 mqa-zlgl" style="position: absolute; z-index: 0; left: 400px; top: 150px;"> 
<div class="mqa-zl mqa-zl10 mqa-zlf" style="position: absolute; z-index: 22;"> 
<div class="mqa-zl mqa-zl1000 mqa-zlf" style="position: absolute; z-index: 1000;"> 
<div class="mqa-zl mqa-zl1000 mqa-zlgl" style="position: absolute; z-index: 1000; left: 400px; top: 150px;"> 
<div class="mqa-zl mqa-zl5 mqa-zlgl" style="position: absolute; z-index: 5; left: 400px; top: 150px;"> 
</div> 
</div> 
</div> 

該HTML代表了科羅拉多州的詳細地圖嗎?

感謝

回答

3

,你看到由JavaScript API生成的地圖是由一組被下載並安裝到創建地圖的地圖圖像塊的創建。在用戶平移和放大/縮小時下載更多的貼圖。

地圖切片被來自世界各地的各種服務器緩存和託管。

+0

好的。但是,上面顯示的div#map HTML如何獲取傳遞到此div的切片? – Steve

相關問題