如何获得持续的导航与谷歌地图API的流量? [英] How to get navigation duration with traffic from google maps api?

查看:184
本文介绍了如何获得持续的导航与谷歌地图API的流量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从http请求谷歌地图API的导航时间:
https://maps.googleapis.com/maps/api/directions/json?origin=src&destination=destination

I want to get the navigation duration from google maps api with http request: https://maps.googleapis.com/maps/api/directions/json?origin=src&destination=destination

但我得到的时间没有交通。
我怎样才能获得持续的交通?

but i get the duration without traffic. how can i get the duration with traffic?

推荐答案

从谷歌地图API,它指出:

From the Google Directions API, it states that:

duration_in_traffic indicates the total duration of this leg, taking into account current traffic conditions. The duration in traffic will only be returned if all of the following are true:

1.The directions request includes a departure_time parameter set to a value within a few minutes of the current time.
2.The request includes a valid Google Maps API for Work client and signature parameter.
3.Traffic conditions are available for the requested route.
4.The directions request does not include stopover waypoints.

所以,你需要满足以交通时间检索上述所有要求。

So you need to meet all the above requirements in order to retrieve duration with traffic.

有关更多信息,请访问的谷歌的腿部分地图API文档。

For more information, you can visit the Leg section of the Google Directions API documentation.

这篇关于如何获得持续的导航与谷歌地图API的流量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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