如何使用loadGeojson
函數Gmaps攔截加載GeoJSON?我揹着MULTILINESTRING的gejson但需要幾秒鐘的時間出現在屏幕上,我需要添加加載用戶等待充電在使用Gmaps加載GeoJSON時顯示加載狀態
function load(){
google.maps.event.addListener(myLayer, 'addfeature', function (e) {
map.setCenter(e.feature.getGeometry().getAt(0).getAt(0));
});
myLayer.loadGeoJson("/data/myLayer.json");
myLayer.setMap(map);
myLayer.setStyle(function(feature) {
return {
strokeColor: "#B00000",
strokeOpacity:0.8,
strokeWeight: 4
};
});
}
伊萬你的答案是解決我的問題。謝謝!但還是有一個疑問,只有當我創建一個新的地圖對象的工作:
......
var map = new google.maps.Map(document.getElementById('map'), mapOptions);
cicloviasLayer.setMap(map);
我不希望創建一個新的地圖,劇情在現有的地圖,我如何才能在這種情況下,加載運行?
Ivan我需要更多的信息sbore加載一個地圖對象存在,我編輯我的問題 – csf