I have an application where the user selects some "markers" from a google maps (all those coordinates' markers are stored into a postgresql database).
Right now, I can draw the route between all selected markers (using DirectionService) but when I have over 10 waypoints the route seems to be drawn in the user selected order (not in the "shortest route" order - I also used
optimizeWaypoints parameter to true and split the route into subroutes of 8 points + start and stop points without success).
What I`m trying to do now: when the user selects a marker, I save his selection (marker coordinates) and then all selected coordinates are sent (via ajax)
to the server.
The received coordinates are in a format something like this:
array((lat1,lng1), (lat2,lng2), ...(latn,lngn))
From here, I want to return back to the user all those coordinates ordered by "shortest path" and I don't know how to achieve this.
Any idea will be great.