3

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?

Bart
  • 19,692
  • 7
  • 68
  • 77
johnnyGor
  • 161
  • 1
  • 3
  • 16
  • If you don't want links (lines) between the points to visit (of which the order is undetermined), why don't you just put markers there? – j13r Mar 03 '12 at 19:00

3 Answers3

2

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.

rhinoeli
  • 151
  • 7
2

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/

j13r
  • 2,576
  • 2
  • 21
  • 28
1

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.

Micromega
  • 12,486
  • 7
  • 35
  • 72