Direction Service Request problem

14 views
Skip to first unread message

Carlos Cabanes

unread,
Jul 29, 2011, 4:08:47 AM7/29/11
to google-map...@googlegroups.com
Hello,
First sorry about my English...

I´m working in a application using DirectionServices. I need to  know the distance betwen a cup of points.
Mi problem is that I have a For bucle in my javascript source and I send the route in DirectionService.route().  After that I use the response (DirectionResutl) to analice the legs and steps about the route.

I know the response of this function is asyncronous, and I only can save data if I use an alert message after every route, but It can be a solution because I have a lot of points to study. If i dont stop the application, the javascript code run faster than the google response and the appiclation dont work.

Can anyone tell me any idea to solve this problem?

Thanks!

Rossko

unread,
Jul 29, 2011, 1:19:20 PM7/29/11
to Google Maps JavaScript API v3
> Can anyone tell me any idea to solve this problem?

You might implement a queue.
Send a request for the first item in the queue.
When the response comes, process it.
Remove the completed item from the queue.
Look to see if there is a next request in the queue, and send that.

Beware of the terms of use, regarding displaying Directions results
and saving data extracted from results.
Reply all
Reply to author
Forward
0 new messages