2013-10-29

Google Maps API : 複数のMarker を一括消去する

MVCArray.forEach を使う。
markerList = new google.maps.MVCArray();

    marker1.setMap(map);
    markerList.push(marker1);

    marker2.setMap(map);
    markerList.push(marker2);

  :

    markerList.forEach(function(marker, idx) {
      marker.setMap(null);
    });

応用例(GpxClipper:gpxファイルを加工するウェブアプリ)


関連ページ
参考にしたページ