简体   繁体   English

Google Directions API回应中的duration和duration_in_traffic之间的差异

[英]Difference between duration and duration_in_traffic in Google Directions API Response

After working with the Google Directions API for a project I found multiple responses with a (much) shorter value in duration_in_traffic than duration . 在为一个项目使用Google Directions API之后 ,我发现多个响应的duration_in_traffic值(比duration短)(很多)。 An example extract from one of the responses i got: 从我得到的响应之一中提取的示例:

"duration": {
    "text": "23 mins",
    "value": 1374
},
"duration_in_traffic": {
    "text": "16 mins",
    "value": 941
},
"end_address": "2868 Mission St, San Francisco, CA 94110, USA",
"end_location": {
    "lat": 37.7522994,
    "lng": -122.4184684
},
"start_address": "O'Farrell St & Powell St, San Francisco, CA 94102, USA",
"start_location": {
    "lat": 37.78640559999999,
    "lng": -122.4082846
},

This doesn't seem to make much sense to me, since i assumed duration is simply the duration without traffic , while duration_in_traffic obviously incorporates traffic conditions. 这对我来说似乎没有多大意义,因为我假设持续时间只是没有交通持续时间 ,而duration_in_traffic显然包含了交通状况。 I found an answer on a different thread, but the person answering provided no source to back up his or her claim/observation. 我在不同的线索上找到了答案 ,但是回答的人没有提供任何资料来支持他或她的主张/观察结果。 Is there more information about the duration response field out there besides the documentation itself, which just describes it as “[indicating] the total duration of this leg”? 除了文档本身之外,是否还有关于工期响应字段的更多信息, 文档本身只是将其描述为“ [表明]这条腿的总工期”? Is there a source stating that it actually is the average time for that route? 是否有消息指出这实际上是该路线的平均时间? And what is the difference between duration and duration_in_traffic? duration和duration_in_traffic有什么区别?

After searching for more information about the difference between these two fields I came across this thread on the google issue tracker. 搜索有关这两个字段之间差异的更多信息后,我在Google问题跟踪器上遇到了该线程 There it is explained that the value in duration " takes into consideration historical data [...] ", while duration_in_traffic " takes into account live traffic data in relation to your departure time ". 在此说明,持续时间“中的值考虑了历史数据 ”,而duration_in_traffic“ 考虑了与您的出发时间有关的实时交通数据 ”。 While this doesn't fully explain how the duration value is calculated, it at least extends the official documentation and confirms that historical data is used for the duration value. 尽管这不能完全说明持续时间值的计算方式,但至少可以扩展官方文档并确认将历史数据用于持续时间值。 This also seems to be the only reliable information about the duration field on the web besides the official documentation which isn't very in depth. 除了不是很深入的官方文档之外,这似乎是有关Web持续时间字段的唯一可靠信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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