【发布时间】:2012-04-27 23:04:55
【问题描述】:
关于 Google Maps V3 API 航点有很多问题,但没有一个可以解决如何从一组任意航点获取最佳往返路线。基本上,称重点的顺序应由最佳路径决定,不一定由输入系统的顺序决定。有人知道这是否可能吗?
【问题讨论】:
标签: google-maps map google-maps-api-3
关于 Google Maps V3 API 航点有很多问题,但没有一个可以解决如何从一组任意航点获取最佳往返路线。基本上,称重点的顺序应由最佳路径决定,不一定由输入系统的顺序决定。有人知道这是否可能吗?
【问题讨论】:
标签: google-maps map google-maps-api-3
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
【讨论】: