Map google bursts when I push the markers [closed]

1

My function to add markers to the map is as follows:

function setMarkers(map, locations) {
              var i
              for (i = 0; i < locations.length; i++)
              {  
                  var loan = locations[i][0]
                  var lat = locations[i][1]
                  var long = locations[i][2]
                  var add =  locations[i][3]
                  var image = locations[i][4]

                  latlngset = new google.maps.LatLng(lat, long);

                  var marker = new google.maps.Marker({  
                      position: latlngset,
                      title: loan, 
                      icon: image, 
                      map: map  
                  });
                  var content = "<strong>Nome: </strong>" + loan +  '</br>' + "<strong>Morada: </strong>" + add     
                  var infowindow = new google.maps.InfoWindow()

                  google.maps.event.addListener(marker,'click', (function(marker,content,infowindow){ 
                      return function() {
                          infowindow.setContent(content);
                          infowindow.open(map,marker);
                      };
                  })
                  (marker,content,infowindow)); 
              }
          }

Since I need to remove some Markers when a checbox is clicked, I will search and have the following code:

var marker = new google.maps.Marker({  
                      position: latlngset,
                      title: loan, 
                      icon: image, 
                      map: map  
                  });

                 gmarkers.push(marker);

where gmarkers = [];

But in%% of% the map bursts. What can I do wrong?

    
asked by anonymous 16.05.2016 / 14:02

0 answers