gpt4 book ai didi

google-maps-api-3 - 使用 Google Maps Distance Matrix API 时是否可以通过多种出行方式

转载 作者:行者123 更新时间:2023-12-04 14:25:52 27 4
gpt4 key购买 nike

我需要计算多种出行方式的时间和距离,我尝试传递以 | 分隔的多种出行方式。像这样:

https://maps.googleapis.com/maps/api/distancematrix/json?origins=E149AQ&destinations=UB83PH|NW14SA|WC1E7HU|N78DB&mode=walking|bicycling|driving&language=en-GB&key=myKey
但它不像我预期的那样工作。

最佳答案

每个请求仅支持一种出行模式。要获得多种出行模式的结果,请发出多个请求。
documentation暗示但没有明确说明:
可选参数

mode (defaults to driving) — Specifies the mode of transport to use when calculating distance. Valid values and other request details are specified in the Travel Modes section of this document.


出行方式

For the calculation of distances, you may specify the transportation mode to use. By default, distances are calculated for driving directions. The following travel modes are supported:

  • driving (default) indicates distance calculation using the road network.

  • walking requests distance calculation for walking via pedestrian paths & sidewalks (where available).

  • bicycling requests distance calculation for bicycling via bicycle paths & preferred streets (where available).

  • transit requests distance calculation via public transit routes (where available). This value may only be specified if the request includes an API key or a Google Maps API for Work client ID. If you set the mode to transit you can optionally specify either a departure_time or an arrival_time. If neither time is specified, the departure_time defaults to now (that is, the departure time defaults to the current time). You can also optionally include a transit_mode and/or a transit_routing_preference.

Note: Both walking and bicycling directions may sometimes not include clear pedestrian or bicycling paths, so these directions will return warnings in the returned result which you must display to the user.

关于google-maps-api-3 - 使用 Google Maps Distance Matrix API 时是否可以通过多种出行方式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33449938/

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