GEOG5870/1M: Web-based GIS A course on web-based mapping

If you have lots of markers, you will sometimes want to create a cluster! Here's how:

var center = new google.maps.LatLng( /*YOUR COORDINATES*/);
var options= {
   'zoom': /*YOUR ZOOM*/,
   'center': center,
   'mapTypeId: google.maps.MapTypeId // YOUR MAP TYPE
}
var map = new google.maps.Map(document.getElementById("map"), options);
var markers = [];
for (var i=0; i<100; i++) {
   var latLng = new google.maps.LatLng(data.coord[i].latitude,
      data.coord[i].longitude);
   var marker = new google.maps.Marker({'position': latLng});
   markers.push(marker); // put the marker in the markers array
}
var markerCluster = new MarkerCluster(map, markers);

For more information, see this library.