title: Google Maps V3 - Remove all Markers
body: <p>I want with google maps v3 that if you zoom-in higher than 15 the map show the marker locations but when you zoom-out i want to hide the markers. I can't find any function to do this. Nothing has worked for me so far.</p>
  
  <p>So this is my script: </p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
          function initialize() {
              var mapOptions = {
                zoom: 15,
                center: new google.maps.LatLng(52.429236, 6.281255),
                mapTypeId: google.maps.MapTypeId.ROADMAP
              };
              var map = new google.maps.Map(document.getElementById("map_canvas"), mapOptions);
  
              setMarkers(map, points);
  
              google.maps.event.addListener(map, 'zoom_changed', function()
  {
                          if (map.getZoom() &gt; 15) {
                                  setMarkers(map, points);
                          } else {
                                  hideMarkers(map, points);
  
                          }
                             }); 
  
          }
  
  
          var points = [
              ['Location 1', 52.420891, 6.280204],
              ['Location 2', 52.420125, 6.279131],
              ['Location 3', 52.420125, 6.240125]
          ];
  
  
          function setMarkers(map, locations) {
              var image = new google.maps.MarkerImage('../images/map/beachflag.png',
              new google.maps.Size(20, 32),
              new google.maps.Point(0,0),
              new google.maps.Point(0, 32));
              var shadow = new google.maps.MarkerImage('../images/map/beachflag_shadow.png',
              new google.maps.Size(37, 32),
              new google.maps.Point(0,0),
              new google.maps.Point(0, 32));
              var shape = {
                  coord: [1, 1, 1, 20, 18, 20, 18 , 1],
                  type: 'poly'
              };
  
              for (var i = 0; i &lt; locations.length; i++) {
                  var point = locations[i];
                  var myLatLng = new google.maps.LatLng(point[1], point[2]);
                  var marker = new google.maps.Marker({
                  position: myLatLng,
                  map: map,
                  shadow: shadow,
                  icon: image,
                  shape: shape,
                  title: point[0]
                  });
              }
          }
  
          function hideMarkers(map, locations) {
              /* Remove All Markers */
  
  
              console.log("Remove All Markers");
          }
              &lt;/script&gt;
  </code></pre>
  
  <p>Please can anybody help me whith this?</p>