Bharat Bhatiya Bharat Bhatiya - 10 months ago 68
Javascript Question

google api waypoint need to remove dynamically waypoint from display route

I am trying to remove waypoint from google map route using button click. But there is some problem while searching and removing element and redrawing directions with available elements.

Please check here jsfiddle:

There is on button click function added to remove waypoint from route:

function removewaypoint()

Here jsfiddle contain two issues:
1. Remove element from
array and
2. Redraw map route with new
array its also not working

Answer Source

Hello In remove waypoints you can add id to marker and then during removecode u can try to compare with marker id (which u want to remove). Please provide full code to get the exact solution.

var nwaypts=[];
                        var j=0;
                        for ( var i = 0; i < waypts.length ; i++) {