Bonjour, j'ai une carte google map avec deux boutons "all" et "initialiser", le premier affiche tous les points sur ma carte et le deuxieme me nettoie la carte en supprimant tous les markers

Mon probleme c'est quand je clique sur le bouton all, la map commence a m'afficher tous les points un par un, a ce moment la si je clique sur le bouton initialiser il doit revenir a position initial avec une carte bien nettoyée mais ce n'est pas le cas car la carte continue a m'afficher les points jusqu'à la fin, vous avez une idée ?

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
function clearOverlays() {
 
    if (markers) {
        for (i in markers) {
            markers[i].setMap(null);
        }
        markers = [];
        infos = [];
    }
    if (directionsDisplay.getDirections() != null) {
        directionsDisplay.setMap(null);
        directionsDisplay = new google.maps.DirectionsRenderer();
    }
    //initialize();
}

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
function findAllAddress(tabStation) {
    clearOverlays();
    var n = tabStation.length;
 
 
    for (var i = 0; i < n; i++) {
        findAddress2(tabStation[i][0], tabStation[i][1], tabStation[i][2], tabStation[i][3]);
        }
}
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
function findAddress2(adresse, name, lt, lg) {
 
    var lat = parseFloat(lt.replace(',','.'));
    var lng = parseFloat(lg.replace(',','.'));
 
    var latlng = new google.maps.LatLng(lat, lng);
 
    var address = adresse;  
 
    // script uses our 'geocoder' in order to find location by address name
    geocoder.geocode({ 'latLng': latlng }, function (results, status) {
    if (status == google.maps.GeocoderStatus.OK) { // and, if everything is ok
 
            // we will center map
            var addrLocation = latlng;
            map.setCenter(addrLocation);
 
            // store current coordinates into hidden variables
            document.getElementById('lat').value = lat;
            document.getElementById('lng').value = lng;
 
            // and then - add new custom marker and Infowindow
            var addrMarker = new google.maps.Marker({
 
                position: addrLocation,
                map: map,
                title: results[0].formatted_address
                //animation: google.maps.Animation.BOUNCE
            });
 
            iconFile = 'https://maps.gstatic.com/mapfiles/ms2/micons/gas.png';          
            addrMarker.setIcon(iconFile) ;
 
            var infowindow = new google.maps.InfoWindow({
            content: '<DIV STYLE="line-height:1.35;overflow:hidden;white-space:nowrap;"><DIV STYLE=overflow:auto; width:50px; height:50px><font style="color:#000;">' + name +
            '<br /></font></div></div>'
 
            });
 
            google.maps.event.addListener(addrMarker, 'click', function (data) {
                            infowindow.open(map, addrMarker);
            });
 
 
            markers.push(addrMarker);
 
            addrMarker.indice = markers.length - 1;
 
            // suppression du marker sur dblclick
            google.maps.event.addListener(addrMarker, 'dblclick', function (data) {
                this.setMap(null);
                var ind = this.indice;
                markers.splice(ind, 1);
                // r?©ajuste les indices des autres marqueurs
                for (; markers[ind]; ind++) {
                    markers[ind].indice = ind;
                }
            });
        } 
         else{
      // on traite l'erreur OVER_QUERY_LIMIT
      if( status == google.maps.GeocoderStatus.OVER_QUERY_LIMIT){
        // relance la requete
        setTimeout( function(){
          findAddress2(adresse, name, lt, lg); // rappel fonction avec meme param
        }, 200);
      }
      }
    });
}