Reading up on DirectionsResult in the Services documentation, I came
across use of a non-documented property of the DirectionsStep (at
least I think - am still working on my understanding of this, so am
wanting someone to confirm if I'm right or not).
So what I found is that in "Inspecting DirectionsResults" in the
Services doc, there is example code which includes a function called
showSteps.
This function runs through each step and places a marker.
To get the start point of the marker, the following is used:
directionResult.routes[0].legs[0].start_point
But in the reference there is no property called start_point - it
seems to be called start_location
However, the actual example works with start_point.
Am I missing something or is this an alternative hidden name for the
start_location property?
Below is the function, copied from API v3 Services Doc
Also, as a side note, shouldn't this code also run through all the
legs in the route, since there may be more than one leg? (ie it works
in this case because only one leg is returned in the result)
...stu
function showSteps(directionResult) {
// For each step, place a marker, and add the text to the marker's
// info window. Also attach the marker to an array so we
// can keep track of it and remove it when calculating new
// routes.
var myRoute = directionResult.routes[0].legs[0];
for (var i = 0; i < myRoute.steps.length; i++) {
var marker = new google.maps.Marker({
position: myRoute.steps[i].start_point,
map: map
});
attachInstructionText(marker, myRoute.steps[i].instructions);
markerArray[i] = marker;
}
}
--
You received this message because you are subscribed to the Google Groups
"Google Maps JavaScript API v3" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-maps-js-api-v3?hl=en.