Reputation: 161
I have been searching for some time if it is possible to create route on Google Maps without having start and endpoint, only with way points. I'm trying to show/calculate full route on points user have to visit in right, economic order, but I don't know which one of them should be the first and the last one.
Does Google Maps allow such functionality or I have to take random two points and make them start and final?
Upvotes: 3
Views: 1597
Reputation: 151
Google allows you to add a "optimizeWaypoints" field to your DirectionsRequest. https://developers.google.com/maps/documentation/javascript/directions#DirectionsRequests
I dont know if this function reorders the full route (including start and endpoint) or only the waypoints. If only the waypoints, you may choose two fake "far away" points for start and endpoint, I think that would give a good result.
Upvotes: 2
Reputation: 2671
Google gives a couple of websites
As an API: https://code.google.com/p/google-maps-tsp-solver/
And an implementation: http://gebweb.net/optimap/
Upvotes: 2
Reputation: 12592
You can use the google maps tsp solver to solve a tsp. It uses the Ant Colony Optimization to efficient solve a tsp. Or you can use a fractal for example a hilbert curve.
Upvotes: 1