I currently am developing an app which allows users to click on a map
to add waypoints, recalculate GDirections and display the new route
(easier than trying to implement the Google Drag Route without an
API).

Adding one point is very easy. Let me give you an example:

From:New York to: LA.

I get a nice map. User clicks on, say Wichita. No prob:

waypoints[0] = New York
waypoints[1] = Wichita
waypoints[2] = LA

dir.loadFromWaypoints(waypoints) and presto: new route.

But now, user remembers that she has an aunt Edna in Cleveland and
decides to add Cleveland to the route: So, two possibilities:

waypoints[0] = New York
waypoints[1] = Wichita
waypoints[2] = Cleveland
waypoints[3] = LA

Problem: User ends up backtracking from Wichita to Cleveland. Not
very nice.

Sure, just put the Cleveland waypoint before the Wichita one. Easier
said than done since I have know way of knowing, for any given set of
waypoints > 3, where a new waypoint would go. in the array.

I could calculate routes for all possible combinations and then pick
the shortest route, but the permutations are mind-bogglingly large
when you get past 5 or 6 waypoints.

You guys must have some sort of algo that works with the Google Maps
Drag Route function for determining for a given set of endpoints how
new waypoints are ordered.

Or maybe you just have some ideas on how to solve my problem.

Thanks!





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