繁体   English   中英

如何获取谷歌地图中两个位置之间的总旅行时间?

[英]How to get total travel time between two location in google map?

我实现了要在android中的Google地图中获取两个位置之间的距离,但是我不知道如何获取这两个位置的旅行时间? 我提到很多例子,但我听不懂。 给我举个例子

您可以从[Google Direction API]中获取旅行时间-

链接: https//developers.google.com/maps/documentation/directions/start#sample-request

在URL中提供您的出发地和目的地,您将获得JSON响应。

然后,您可以在响应中找到旅行时间,如下所示:

路线(JSONArray)->腿(JSONArray)->持续时间(JSONObject)

参考链接: https : //developers.google.com/maps/documentation/directions/intro#DirectionsRequests

暂无
暂无

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

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