Re: Problem with loop for getDistance
Use a loop to create global Javascript arrays of atAddress and toAddress
values.
Use a global variable as a counter to remember how many you've done so
far, initially = 0.
Execute the first GDirections call using atAddress[counter] and
toAddress[counter]
In onGDirectionsLoad(), increment the counter and if it's less than
toAddress.length call the next GDirections(). If it is equal to
toAddress.length, perform any final processing.
If you're going to be doing more than about 5 calls, instead of calling
the next GDirections() call immediately, use a setTimeout to add a delay
to avoid exceeding the GDirections speed limit.
--
Mike Williams
http://econym.org.uk/gmap
--
You received this message because you are subscribed to the Google Groups "Google Maps API" group.
To post to this group, send email to google-maps-api@googlegroups.com.
To unsubscribe from this group, send email to google-maps-api+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-maps-api?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home