I have a google map using API v3 which gets directions from one location to another. The app works great but the window which gets the directions is an overlay on the map.
Using directionDisplay.setMap(null);
will remove the whole directions renderer overlay, including markers. If you just want to remove the routes keeping the markers you can use setOptions
to change the options settings of DirectionsRenderer for suppressPolylines
after initialization
directionsDisplay.setOptions({
suppressPolylines: true
});
(see also my other similar answer)