【问题标题】:duration_in_traffic is not returned in Google MapsGoogle 地图中不返回 duration_in_traffic
【发布时间】:2018-05-14 10:47:33
【问题描述】:

我正在尝试执行 url 查询,但 没有关于流量持续时间的结果

https://maps.googleapis.com/maps/api/distancematrix/json?origins=garching&destinations=hamburg&departure_time=now&api_key=my_api_key

查询结果如下:

{
   "destination_addresses" : [ "Гамбург, Германия" ],  
   "origin_addresses" : [ "85748 Гархинг, Германия" ],  
   "rows" : [  
      {  
         "elements" : [  
            {  
               "distance" : {  
                  "text" : "761 км",  
                  "value" : 761011  
               },  
               "duration" : {  
                  "text" : "7 ч. 17 мин.",  
                  "value" : 26216  
               },  
               "status" : "OK"  
            }  
         ]  
      }
   ],  
   "status" : "OK"  
}

结果不包含duration_in_traffic。为什么?

【问题讨论】:

    标签: google-maps google-distancematrix-api


    【解决方案1】:

    duration_in_traffic 结果仅在流量数据可用且指定departure_time 时返回。

    https://developers.google.com/maps/documentation/javascript/distancematrix

    似乎没有该目的地/起点的交通数据。

    【讨论】:

    • 赛斯,谢谢你的回答。这似乎是真的。但我在一些 googledocumentation 页面中看到,它足以让 api 密钥使用 duration-IN-traffic(没有高级计划)。显然它是古老的页面。
    • 介意分享那些过时的页面吗?
    • ...仅在满足以下所有条件时才返回流量持续时间: 1. 请求包含一个离开时间参数。 2. 请求包括有效的 API 密钥、有效的 Google Maps APIs Premium Plan 客户端 ID 和签名。 3. 请求路线的交通状况。 4.模式参数设置为驾驶。
    猜你喜欢
    • 2019-01-05
    • 2014-03-06
    • 2012-09-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-06-18
    • 1970-01-01
    相关资源
    最近更新 更多