I was wondering if there is a more efficient way for me to go about
calculating the shortest distance between two locations.  I am running
a search based upon what the user types into the web form, and then
looping through all the addresses in my datastore.

Is there a more efficient way to get the shortest distance between two
locations rather than hitting Google X amount of times (where X is
equal to the number of addresses in my datastore).

Here is how I am currently doing it:

1.  I have a gDirections object, which gets loaded with the address
the user typed in, and the first address from the datastore.

2.  Once the directions are loaded, I check the distance between those
two points by calling the getDistance().meters function.

3.  I store the distance, and continue looping through all the
addresses in the datastore and loading the directions time after
time.  I check to see if the distance is shorter, and if so then I
store the address so I know that that is the shortest address.

If you need clarification, feel free to ask.  I just feel like there
is a lot of overhead on this application, and I'd like to make it a
little more efficient.

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to