Hello,
I want to be able to plot a route in Google Maps, modify that route by dragging it, save the changes and reload it at some later time and edit it further. In the same manner as Google's MyMap. Simply saving the origin and destination locations wont work as it wont reload the same route.
I can save all of the points in the via_waypoint[] array. This allows me to redraw the route as a polyline but it is no longer editable.
The documentation says that the DirectionsResult is returned in JSON format. So I've tried to convert the DirectionsResult to a JSON string, save and reload that string as a JSON object and pass it to the DirectionsRenderer. But it doesn't display and no errors are thrown.
Below is a sample of what I was trying to do. I've skipped the saving to the database step. I convert the DirectionsResult to a string and then back to a JSON object.
directionsService.route(request, function(response, status) {
if (status == google.maps.DirectionsStatus.OK) {
var str = JSON.stringify(response))
var obj= JSON.parse(str)
directionsDisplay.setDirections(obj);
}
Any help would be gratefully appreciated.
Thanks