I am drawing a route in Google Maps. I have passed the start point, way points and end points. My route is drawing correctly. I am using Google Maps API 3.
request = {
origin: originAddress,
destination: destinationAddress,
waypoints: waypoints,
optimizeWaypoints: false,
travelMode: google.maps.DirectionsTravelMode.DRIVING
};
directionsService.route(request, function(response, status) {
if (status == google.maps.DirectionsStatus.OK) {
directionsDisplay.setDirections(response);
}
}
If I change the route direction, then how to find the changed direction points' latitude and longitude?
Any help will be appreciated.
Best Answer
When taking a look at this reference DirectionsRenderer Reference, look for the event
After rendering your directions, introduce an event listener on the DirectionsRenderer object. Something like this:
Very important thing is to make sure you set the draggable attribute of the DirectionsRenderer object to true. Note that the code here is mainly take out from the link Mapperz gave in his comment.