-1
我想在自定義地圖上顯示100個標記,我應該在單個標記代碼下面重複100次,並且有大量文件,或者有其他更緊湊的方法來創建多個標記嗎?如何在Google地圖上創建多個標記100+
var marker = new google.maps.Marker({
position: new google.maps.LatLng(34.052661,-118.269976),
title:"Hello World!",
map:map,
animation: google.maps.Animation.DROP
});
google.maps.event.addListener(marker, 'click', function() {
infowindow.open(map,marker);
});
var infowindow = new google.maps.InfoWindow({
content: '<div id="content">'+
'<div id="siteNotice">'+
'</div>'+
'<h1 id="firstHeading" class="firstHeading">Uluru</h1>'+
'<div id="bodyContent">'+
'<p><b>Uluru</b>, also referred to as <b>Ayers Rock</b>, is a large ' +
'sandstone rock formation in the southern part of the '+
'Northern Territory, central Australia. It lies 335 km (208 mi) '+
'south west of the nearest large town, Alice Springs; 450 km '+
'(280 mi) by road. Kata Tjuta and Uluru are the two major '+
'features of the Uluru - Kata Tjuta National Park. Uluru is '+
'sacred to the Pitjantjatjara and Yankunytjatjara, the '+
'Aboriginal people of the area. It has many springs, waterholes, '+
'rock caves and ancient paintings. Uluru is listed as a World '+
'Heritage Site.</p>'+
'<p>Attribution: Uluru, <a href="http://en.wikipedia.org/w/index.php?title=Uluru&oldid=297882194">'+
'http://en.wikipedia.org/w/index.php?title=Uluru</a> '+
'(last visited June 22, 2009).</p>'+
'</div>'+
'</div>',
});
我是保持客戶端下載更小的更值得關注,認爲谷歌有更有效的方式來增加航點 –
你可以試試庫多標記與甚至1000個標記快速度似乎作品: https://code.google.com/p/multimarker/ – cesare
multimarker似乎是一個被遺棄的項目,只是fyi –