[英]How to get total travel time between two location in google map?
I implement to get distance between two location in google map in android but i have not idea how to get travel time for this two location ? 我实现了要在android中的Google地图中获取两个位置之间的距离,但是我不知道如何获取这两个位置的旅行时间? I refer many example but i can not understand.
我提到很多例子,但我听不懂。 Give me example
给我举个例子
You can get travel time from [Google Direction API] - 您可以从[Google Direction API]中获取旅行时间-
Link: https://developers.google.com/maps/documentation/directions/start#sample-request 链接: https : //developers.google.com/maps/documentation/directions/start#sample-request
Provide your origin & destination in the URL and you'll get a JSON Response. 在URL中提供您的出发地和目的地,您将获得JSON响应。
You can then find travel time in the response as: 然后,您可以在响应中找到旅行时间,如下所示:
routes(JSONArray) -> legs(JSONArray) -> duration(JSONObject) 路线(JSONArray)->腿(JSONArray)->持续时间(JSONObject)
Reference Link: https://developers.google.com/maps/documentation/directions/intro#DirectionsRequests 参考链接: https : //developers.google.com/maps/documentation/directions/intro#DirectionsRequests
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.