Vin*_*nyD 5 google-maps map google-maps-api-3
有关Google Maps V3 API航点的问题很多,但没有一个问题涉及如何从一组任意航路点获得最佳往返航线.基本上,称重点的顺序应由最佳路径确定,并且不一定由送入系统的顺序决定.有人知道这是否可能吗?
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.
Run Code Online (Sandbox Code Playgroud)
来自https://developers.google.com/maps/documentation/javascript/reference的第一段.
其次来自https://developers.google.com/maps/documentation/javascript/directions
| 归档时间: |
|
| 查看次数: |
3428 次 |
| 最近记录: |