Google map directionsService.route need add remove waypoint using javascript.
It is possible to add new point to array using code:
waypts.push({ location: "Rome, Italy", stopover: true });
Problem when remove waypoint from array
Here my some data example that can explain more brief;
Need to remove point 1 or point 2 from above javascript object array how do it possible.
Then I will create new waypts for each time route draw from above array named
nwaypts.
var nwaypts = [
{ location: "Rome, Italy", stopover: true }, // xyz: start point
{ location: { lat: 42.2070007, lng: 12.48549939999998 }, stopover: true, id: "17167" }, // point 1
{ location: { lat: 42.3793831, lng: 12.82857039999999 }, stopover: true, id: "18823" }, // point 2
{ location: "Terni, Italy", stopover: true } // xyz: end point
];