We have a lot of problems with MarkerManager. Sometimes it works with 6 
markers, but never doesn´t work with more (and we have around 1000 in the 
xml file). 

This is the code. Could anyone help us?

Thanks

(Excuse for our poor English.)

<script type="text/javascript"> 
//<![CDATA[
      
      var latcenter = "";
      var lngcenter = "";    
      var importancia = "";    
      var mgr = null;
       
     seleccion=eval(lat);    
   
      // arrays to hold copies of the markers
      // because the function closure trick doesnt work there 

      var gmarkers = []; 
      var gmarkersA = []; 
      var gmarkersB = []; 
      var gmarkersC = []; 
      var gmarkersD = [];                   
      var gmarkersE = [];    
      var gmarkersF = [];                
      
     // global "map" variable
      var map = null;


// A function to create the marker and set up the event window function 
function createMarker(latlng, html,zoom) {
    var contentString = html;
    var marker = new google.maps.Marker({
        position: latlng,
        map: map,
        zIndex: Math.round(latlng.lat()*-100000)<<5
        });

    google.maps.event.addListener(marker, 'click', function() {
        infowindow.setContent(contentString); 
        infowindow.open(map,marker);
        });
       
    google.maps.event.addListener(marker, 'mouseover', function() {
        infowindow.setContent(contentString); 
        infowindow.open(map,marker);
        });
    // save the info we need to use later for the side_bar
    gmarkers.push(marker);
    if (parseInt(zoom) == 1) {
            gmarkersA.push(marker);
          }    
       if (parseInt(zoom) == 2) {
            gmarkersB.push(marker);

          } 
    if  (parseInt(zoom) == 3) {
            gmarkersC.push(marker);

          } 

    if  (parseInt(zoom) == 4) {
            gmarkersD.push(marker);

          } 

    if  (parseInt(zoom) == 5) {
            gmarkersE.push(marker);

          } 

    if  (parseInt(zoom) == 6) {
            gmarkersF.push(marker);

          }           
//    alert (gmarkers);

}
 
// This function picks up the click and opens the corresponding info window
function myclick(i) {
  google.maps.event.trigger(gmarkers[i], "click");
}

 
function initialize() {
  // create the map
  var myOptions = {
    zoom: lon,
    center: new google.maps.LatLng(latcenter,lngcenter),
    mapTypeControl: true,
    mapTypeControlOptions: {style: 
google.maps.MapTypeControlStyle.DROPDOWN_MENU},
    navigationControl: true,
    mapTypeId: google.maps.MapTypeId.ROADMAP
  }
    map = new google.maps.Map(document.getElementById("map_canvas"),
                                myOptions);
 
    setupWeatherMarkers();
 

    google.maps.event.addListener(map, 'click', function() {
        infowindow.close();
        });

    google.maps.event.addListener(map, 'zoom_changed', function() {
        infowindow.close();
        });

      // Read the data from example.xml
      downloadUrl("example.xml", function(doc) {
        var xmlDoc = xmlParse(doc);
        var markers = xmlDoc.documentElement.getElementsByTagName("marker");
        latcenter = parseFloat(markers[seleccion].getAttribute("lat"));
        lngcenter = parseFloat(markers[seleccion].getAttribute("lng"));
       alert (latcenter);
        alert (lngcenter);
        for (var i = 0; i < markers.length; i++) {
          // obtain the attribues of each marker
          var lat = parseFloat(markers[i].getAttribute("lat"));
          var lng = parseFloat(markers[i].getAttribute("lng"));
          var point = new google.maps.LatLng(lat,lng);
          var html = markers[i].getAttribute("html");
          importancia = markers[i].getAttribute("importancia");         

          // create the marker         
          var marker = createMarker(point,html,importancia);
        }
        myclick (seleccion);

      });
    }

var infowindow = new google.maps.InfoWindow;  


     
function setupWeatherMarkers() {
      mgr = new MarkerManager(map, { borderPadding: 50 });
      
      google.maps.event.addListener(mgr, 'loaded', function(){
          mgr.addMarkers(gmarkersA,2);
          mgr.addMarkers(gmarkersB,6);
          mgr.addMarkers(gmarkersC,8);         
          mgr.addMarkers(gmarkersD,9);     
          mgr.addMarkers(gmarkersE,10);              
          mgr.addMarkers(gmarkersF,11);    
                    
          mgr.refresh();          
      });      
    }
    
    
    // This Javascript is based on code provided by the
    // Community Church Javascript Team
    // http://www.bisphamchurch.org.uk/   
    // http://econym.org.uk/gmap/
    // from the v2 tutorial page at:
    // http://econym.org.uk/gmap/basic3.htm 
//]]>
</script>

El martes, 12 de julio de 2011 18:17:40 UTC+2, Ralph escribió:
>
> >>But I still don't know how to implement the infowindow using marker
> >>manager...thanks for any help!
>
> I have added the marker manager to the example.
>
> http://www.easypagez.com/examples/sr.html
>
> for demo purposes the markers will only show at zoom 7
>
> Ralph
>
>
> -- 
> 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 
> google-map...@googlegroups.com<javascript:>
> .
> To unsubscribe from this group, send email to
> google-maps-js-api-v3+unsubscr...@googlegroups.com <javascript:>.
> For more options, visit this group at
> http://groups.google.com/group/google-maps-js-api-v3?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Maps JavaScript API v3" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-maps-js-api-v3+unsubscr...@googlegroups.com.
To post to this group, send email to google-maps-js-api-v3@googlegroups.com.
Visit this group at http://groups.google.com/group/google-maps-js-api-v3?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to