在Google地图中未返回duration_in_traffic

时间:2017-11-30 13:26:39

标签: google-maps google-distancematrix-api

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

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。为什么呢?

1 个答案:

答案 0 :(得分:1)

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

  

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

似乎没有可用于该目的地/来源的交通数据。