remove route with google map

You could also use:

directionsDisplay.setDirections({routes: []});

In this way, you can keep using one map with one renderer for all routes.


if you are using DirectionsRenderer to display the routes, you can call setMap(null) on it too. That way you delete the displayed route.

Using the example code here http://code.google.com/apis/maps/documentation/javascript/examples/directions-simple.html

just call

directionsDisplay.setMap(null);

The other answers did not work for me. I found a solution from this question

define directionsDisplay only 1 time(outside of the click-handler)