5

关于 Google Maps V3 API 航点有很多问题,但没有一个可以解决如何从一组任意航点获得最佳往返路线。基本上,称重点的顺序应由最佳路径决定,不一定由输入系统的顺序决定。有人知道这是否可能吗?

4

1 回答 1

9

V3 API 中有一个“优化”选项。你试过了吗?

optimizeWaypoints

If set to true, the DirectionService will attempt to re-order the supplied 
intermediate waypoints to minimize overall cost of the route. If waypoints 
are optimized, inspect DirectionsRoute.waypoint_order in the response to 
determine the new ordering.

optimizeWaypoints (optional) specifies that the route using the supplied 
waypoints may be optimized to provide the shortest possible route.

第一段来自https://developers.google.com/maps/documentation/javascript/reference

第二个来自https://developers.google.com/maps/documentation/javascript/directions

于 2012-04-27T23:34:36.547 回答