In Google Maps API v2, if I wanted to remove all the map markers, I could simply do:
map.clearOverlays();
How do I do this in Google Maps A
This is the method Google themselves use in at least one sample:
var markers = [];
// Clear out the old markers.
markers.forEach(function(marker) {
marker.setMap(null);
});
markers = [];
Check Google sample for complete code example:
https://developers.google.com/maps/documentation/javascript/examples/places-searchbox