The GDirections class of Google maps API helped me in "displaying" the route between two supplied coordinates.
Now I want a list of ALL the coordinates on that route.
Any hints on how to get this?
EDIT Just now discovered http://code.google.com/apis/maps/documentation/javascript/reference.html#DirectionsRoute
Its overview_path property gives the list of ALL the waypoints of the route. Is DirectionsRoutethe right class for this problem Or I am missing some point?
EDIT - 2
With the help of this link shown by mkram0 below, I have modified the code as follows:
The Map IS getting displayed. The Route IS getting displayed.
I was thinking of placing markers on the first four coordinates on the route. Those markers don't get displayed. Any helps? Please.
directionsService.route (request,
function (result, status)
{
if (status == google.maps.DirectionsStatus.OK)
{
directionsDisplay.setDirections (result);
for (var route in result.routes)
{
for (var leg in route.legs)
{
for (var step in leg.steps)
{
for (var latlng in step.path)
{
pointsArray.push(latlng);
}
}
}
}
var point1 = new google.maps.Marker ({
position:pointsArray[0],
draggable:true,
map:map,
flat:true
});
var point2 = new google.maps.Marker ({
position:pointsArray[1],
draggable:true,
map:map,
flat:true
});
var point3 = new google.maps.Marker ({
position:pointsArray[2],
draggable:true,
map:map,
flat:true
});
var point4 = new google.maps.Marker ({
position:pointsArray[3],
draggable:true,
map:map,
flat:true
});
}
});