Thanks you, Andrew ! I am sorry for my description because English is not my native language :(
I am a newer and it is my first time to try the Google map API. I just wanna show the shortest driving direction from the user's postion to the nearest ATM. I try to calcuate for each ATM and choose the shorest, it will calculate 20 times to get the result. If the ATM number keep increasing, I believe the calculate time will become more slowly. Do you have any idea for my question now? or if the Google Map API already has some function for my question? No matter what, I'm appreciate for your reply, Thank you, Andrew ! l...@china On Mar 26, 8:28 pm, Andrew Leach <[email protected]> wrote: > On Mar 26, 11:49 am, Li Li <[email protected]> wrote: > > > I have 20 ATM position in a city. > > The user will choose the start point by the zip code,Google map will > > show the therouteto the nearest ATM. > > > now, I could calculate (by the getDistance method) user's zip code > > postion to each ATM one by one, that means loop 20times, then choose > > the nearest, but it too slowly and inefficient. > > What are you asking? Are you asking to choose the nearest ATM, or > theshortestrouteto visit all the ATMs? > > If the nearest ATM because you just want some cash, then you are going > to have to examine each distance to see which is theshortest. You > could cut down the number of directions calls by limiting the ATMs you > calculate to those within a certain straight-line distance. Example: > you have 20 ATMs and you want to find theshortestrouteto any one of > them -- it doesn't matter which. Select the five which are closest and > analyse therouteto each of those. You might even get away with > analysing routes to two or three of them, especially if you're > walking. > > If you want theshortestroutebetween all the ATMs, perhaps because > you're delivering cash to them, it's the Travelling Salesman Problem > and searching for that will find some resources. > > Andrew --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google Maps API" 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-API?hl=en -~----------~----~----~----~------~----~------~--~---
