Duration_in_traffic小于google Distance Matrix API中的持续时间 [英] Duration_in_traffic less than duration in google Distance Matrix API

查看:108
本文介绍了Duration_in_traffic小于google Distance Matrix API中的持续时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用DistanceMatrix API同时使用duration_in_traffic和duration功能。

I am using both the "duration_in_traffic" and "duration" feature using the DistanceMatrix API.

对于给定的坐标对,我看到以下结果:

For a given coordinate pair, I see the following results:

{
  "destination_addresses": [
    "Hamburg, Germany"
  ],
  "origin_addresses": [
    "85748 Garching, Germany"
  ],
  "rows": [
    {
      "elements": [
        {
          "distance": {
            "text": "761 km",
            "value": 760831
          },
          "duration": {
            "text": "7 hours 1 min",
            "value": 25242
          },
          "duration_in_traffic": {
            "text": "6 hours 42 mins",
            "value": 24145
          },
          "status": "OK"
        }
      ]
    }
  ],
  "status": "OK"
}

这是我的问题:

durat是怎么回事ion_in_traffic小于持续时间?

根据我的理解:

持续时间:旅行持续时间在路线上...不确定是否没有交通

Duration: Duration of travel on a route... Not sure if it is without traffic

Duration_in_traffic:交通条件下路线的行程持续时间。

Duration_in_traffic: Duration of travel on a route under traffic conditions.

对此的任何解释将不胜感激。

Any explanation on this will be greatly appreciated.

推荐答案


注意:durationInTraffic字段现已弃用。以前
是Google Maps API for Work客户指定
的推荐方式,结果是否应包含考虑
当前流量条件的持续时间。您现在应该使用drivingOptions
字段。

Note: The durationInTraffic field is now deprecated. It was previously the recommended way for Google Maps API for Work customers to specify whether the result should include a duration that takes into account current traffic conditions. You should now use the drivingOptions field instead.

持续时间似乎平均为持续时间在不同时间/历史数据,而 duration_in_traffic 考虑给定的出发时间(和实时流量)。所以这条路线平均需要 7小时1分钟,但是按照你给定的时间你只需要从汉堡到Garching <6小时42分钟。

Duration seems to take an average of durations at different times/from historic data, while duration_in_traffic takes the given departure time (and live traffic) into account. So the route takes 7 hours 1 min in average, but with your given time it only takes you 6 hours 42 mins from Hamburg to Garching.

我不知道谷歌是否有详细的数据,但可能是因为交通密集,白天高速公路的一部分大部分时间限制在60公里/小时。您的旅行时间大约是23:00,因此您可以以120公里/小时的速度行驶。

I don't know if Google has that detailed data, but it could be that during the day a part of the highway is most of the times limited to 60 km/h because of dense traffic, while your travel time is around 23:00 and due to that you are allowed to drive 120 km/h.

traffic_model :best_guess,悲观和乐观,可以影响 duration_in_traffic 值。

这篇关于Duration_in_traffic小于google Distance Matrix API中的持续时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆