how to find the selected route index in google map api v 3

590 views
Skip to first unread message

sam

unread,
Dec 15, 2011, 11:59:00 PM12/15/11
to Google Maps JavaScript API v3
I am using google map 3 and able to show multiple routes in the div
which i pass in setpanel() method. now what i want is when i click on
any suggested route i should able to get the index of that route.
please help its urgent. thanks in advance.

MymsMan

unread,
Dec 16, 2011, 6:18:24 AM12/16/11
to google-map...@googlegroups.com
Unfortunately no event is driven when the RouteIndex is changed by selecting a new route in the directions panel.
I raised the issue a while back http://code.google.com/p/gmaps-api-issues/issues/detail?id=3565

sam

unread,
Dec 16, 2011, 6:24:14 AM12/16/11
to google-map...@googlegroups.com
then how can i figure out the index any other way ??

MymsMan

unread,
Dec 16, 2011, 7:27:30 AM12/16/11
to google-map...@googlegroups.com
You could possibly use a setTimeout loop to poll for  the current value every second an see if it has changed but it would be a bit ugly.

sam

unread,
Dec 16, 2011, 7:30:21 AM12/16/11
to google-map...@googlegroups.com
Thanks MymsMan for ur reply but what i want is user will select any route from suggested route and will click on the save button so that i can save the route index in my database.

MymsMan

unread,
Dec 16, 2011, 7:39:24 AM12/16/11
to google-map...@googlegroups.com
If the user is clicking a Save button then you can just retrieve the current value from the Directions renderer object - Rend.getRouteIndex().

What is missing from the API is a notification of when the user selects an alternative route.

sam

unread,
Dec 16, 2011, 8:02:05 AM12/16/11
to google-map...@googlegroups.com
MymsMan

thaaaaaaaaaaaaaankuuuuuuuu soooooo much that worked really fine...cant tell you how long i have been dealing with this issue...

thnks again :)
Reply all
Reply to author
Forward
0 new messages