2016-02-27 25 views
0

下午好!爲了創建由多個圖層組成的交互式地圖,我使用插件傳單-ajax和下載文件。 GeoJSON的。當你指向圖層的對象時,屬性信息(對象s attributes) displays. It is required to include a link to the html page in a number of the object的屬性,我絞盡腦汁完成這項任務一週,請幫助我知道該怎麼做! 代碼如下:Сreate互動式地圖單張-ajax

{ 
    "type": "FeatureCollection", 
    "crs": { 
     "type": "name", 
     "properties": { 
      "name": "urn:ogc:def:crs:OGC:1.3:CRS84" 
     } 
    }, 

    "features": [{ 
     "type": "Feature", 
     "properties": { 
      "id": 2, 
      "date": "2012\/02\/05", 
      "material": "plastic", 
      "Number": 1, 
      "support,feeder": "2 2" 
     }, 
     "geometry": { 
      "type": "MultiPoint", 
      "coordinates": [ 
       [34.377387101428354, 54.063054027736584] 
      ] 
     } 
    }, { 
     "type": "Feature", 
     "properties": { 
      "id": 4, 
      "date": "2012\/02\/05", 
      "material": "plastic", 
      "Number": 1, 
      "support , feeder": "4 2" 
     }, 
     "geometry": { 
      "type": "MultiPoint", 
      "coordinates": [ 
       [34.378052287959541, 54.062481025595972] 
      ] 
     } 
    }, ] 
} 
+0

通過「交互式」定義您的意思。 Leaflet允許您開箱即可創建彈出窗口(在懸停或單擊區域或標記時)或將(javascript)函數綁定到事件。 – Paul

+0

http://213.137.240.143:7778/rcs_8/index1.html當鼠標光標點擊標記時 – dimaolin

回答

0

看起來像這種情況正在發生,因爲你從來沒有真正添加圖層到地圖上。確保添加map.addLayer(dorogi)那些AJAX層的每一個初始化後他們。

或者你可以看data:loaded事件,並添加他們在所有數據已經​​被下載之後。Docs at https://github.com/calvinmetcalf/leaflet-ajax