gpt4 book ai didi

google-maps - Google Maps API V3 - 如何通过任意航点获得最佳往返路线

转载 作者:行者123 更新时间:2023-12-04 17:54:49 28 4
gpt4 key购买 nike

有很多关于 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.

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

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

关于google-maps - Google Maps API V3 - 如何通过任意航点获得最佳往返路线,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10358996/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com