简体   繁体   中英

duration_in_traffic is not returned in Google Maps

I m trying to execute url query but have no results about duration in traffic .

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

The results of query listed below:

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

The result does not contain duration_in_traffic . Why?

The duration_in_traffic result is only returned where traffic data is available, when a departure_time is specified.

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

It seems no traffic data is available for that destination/origin.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM