2010-09-16 18 views
5

İçinde enlem ve boylam değerlerine sahip bir veritabanım var. Her seferinde sadece bir işaretçi gösterebilirim. Aynı anda birden fazla işaretçi göstermek istiyorum. Nasıl yapabilirim?api v2 kullanarak Google Map üzerinde Birden Fazla İşaretçi Ekleme

+1

hoş geldiniz. Geçerli yanıtlar almak için, bize daha fazla bilgi vermeniz ve muhtemelen daha spesifik olması için soruyu daraltmanız gerekir. İşte, iyi sorular sormak için başvurulan bir makaledir: http://www.catb.org/esr/faqs/smart-questions.html – Chadwick

cevap

3

İşte çok temel bir örnek:

<!DOCTYPE html> 
<html> 
<head> 
    <meta http-equiv="content-type" content="text/html; charset=UTF-8" /> 
    <title>Google Maps Multiple Markers</title> 
    <script src="http://maps.google.com/maps?file=api&amp;v=2&amp" 
      type="text/javascript"></script> 
</head> 
<body> 
    <div id="map" style="width: 500px; height: 400px;"></div> 

    <script type="text/javascript"> 
    var locations = [ 
     ['Bondi Beach', -33.890542, 151.274856], 
     ['Coogee Beach', -33.923036, 151.259052], 
     ['Cronulla Beach', -34.028249, 151.157507], 
     ['Manly Beach', -33.800128, 151.282085], 
     ['Maroubra Beach', -33.950198, 151.259302] 
    ]; 

    var map = new GMap2(document.getElementById('map')); 
    var i; 

    map.setCenter(new GLatLng(-33.92, 151.25), 10); 

    for (i = 0; i < locations.length; i++) { 
     map.addOverlay(
     new GMarker(new GLatLng(locations[i][1], locations[i][2])) 
    ); 
    } 
    </script> 
</body> 
</html> 

Ekran Görüntüsü: Stackoverflow Tommy'nin

Adding Multiple Markers on Google Map using api v2

İlgili konular