google 地图 api 方向服务(多路线 & 30 waypoints)

google maps api direction service ( multi routes & 30 waypoints)

我想使用 google 地图 api 用于(多条路线和 30 waypoints)

我有 3 个 driver 和 30 个 waypoints,我想创建三个路由,每个路由有 10 个 waypoints。

我想将路线优化为每个 driver 的最佳路线。

如果我没理解错的话,您希望您的应用的行为类似于 this Google example

请注意,根据 documentation,您最多可以组成 23 waypoints,加上出发地和目的地。

要优化路线,您可以使用 DirectionsRequest 对象的 optimizeWaypoints 字段,当 waypoints 设置为 true 时,它会以更有效的顺序重新排列 waypoints .

作为旁注,我建议您使用 this tool 作为试验场。

希望对您有所帮助!