Hi 

I'm a complete noob to the Google Maps API v.3 but am trying to develop a 
program for my WEB based GIS course. Haven't programmed in about 15 years 
which doesn't help! 

I've got a map of the 118 universities around the UK which shows some 
clustering thta I'd like to use MarkerClustere to get rid of. I've tried to 
integrate it into my code but have had no luck so far - i only seem to get 
one marker out of the 118 to display. I've copied the code into this message 
and wonder if anyone wuld be able to help?

Thanks

var map; 

var myCentreLat = 54.50;
var myCentreLng = -4.00;

var initialZoom = 6;

function infoCallback(infowindow, marker) {
 return function() {
  infowindow.open(map, marker);
 };
}

function addMarker(myPos,myTitle,myInfo,myIcon) {

  var marker = new google.maps.Marker({
    position: myPos, 
    map: map, 
    title: myTitle,
    icon: myIcon,
                });
                
    markers.push(marker);
  var markerclusterer = new MarkerClusterer(map, markers);            
                
 
  var infowindow = new google.maps.InfoWindow({content: myInfo});
  google.maps.event.addListener(marker, 'click', infoCallback(infowindow, 
marker));
  
  
}
  
function initialize() {
  var latlng = new google.maps.LatLng(myCentreLat,myCentreLng);
  var myOptions = {
    zoom: initialZoom,
    center: latlng,
    mapTypeControlOptions: {style: google.maps.MapTypeControlStyle.DEFAULT},
    scaleControl: true,
    scaleControlOptions: {position: google.maps.ControlPosition.RIGHT_TOP},
    zoomControlOptions: {style: google.maps.ZoomControlStyle.SMALL},
    mapTypeId: google.maps.MapTypeId.HYBRID,
  };
  map = new 
google.maps.Map(document.getElementById("map_canvas"),myOptions);
  
  var markers = [ ];
  for (Id in uni_data) {
      var info = "<div class=infowindow><h2>" + uni_data[Id].Name + 
"</h2><p>" + "Address: " + uni_data[Id].Address + "</h2><p>" + "<img 
src=http://chart.apis.google.com/chart?cht=lc&chs=200x125&chd=s:ZreelPuevfgznf2008
 
/>" + "</h2><p>" +  "Rank of 118: " + uni_data[Id].Rank + "</h2><p>" + 
"Undergraduates: " + uni_data[Id].Undergraduates +" ----- " + 
"Postgraduates: " + uni_data[Id].Postgraduates + "</h2><p>" + "<b>Subject 
Scores/100</b>" + "</h2><p>" + "Chemistry - " + uni_data[Id].Chemistry + " 
----- " + "IT - " + uni_data[Id].IT + "</h2><p>" + "Geography - " + 
uni_data[Id].Geography + " ----- " + "Mathematics - " + 
uni_data[Id].Mathematics + "</h2><p>" + "Medicine - " + 
uni_data[Id].Medicine + " ----- " + "Law - " + uni_data[Id].Law + "</h2><p>" 
+ uni_data[Id].URL + "</p></div>";

      // Convert co-ords
      var osPt = new OSRef(uni_data[Id].Easting,uni_data[Id].Northing);
      var llPt = osPt.toLatLng(osPt);
      llPt.OSGB36ToWGS84();

var myIcon;
  for (Category in uni_data){
    if (uni_data[Id].Category == '10') {
    myIcon = 
'http://chart.apis.google.com/chart?chst=d_map_pin_letter&chld=' + 
uni_data[Id].Rank + '|FF0000' 
    }
    else if (uni_data[Id].Category == '25') {
    myIcon = 
'http://chart.apis.google.com/chart?chst=d_map_pin_letter&chld=' + 
uni_data[Id].Rank + '|C34A2C' 
    }
    else if (uni_data[Id].Category == '50') {
    myIcon = 
'http://chart.apis.google.com/chart?chst=d_map_pin_letter&chld=' + 
uni_data[Id].Rank + '|FBB917' 
    }
    else {
    myIcon = 
'http://chart.apis.google.com/chart?chst=d_map_pin_letter&chld=' + 
uni_data[Id].Rank + '|B1FB17' 
   };
      
      }
      addMarker(new 
google.maps.LatLng(llPt.lat,llPt.lng),uni_data[Id].Name,info, myIcon);
       }
}

-- 
You received this message because you are subscribed to the Google Groups 
"Google Maps JavaScript API v3" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-maps-js-api-v3?hl=en.

Reply via email to