[英]Estimated Time Between two Locations(Lattitude & Longitude) in iOS using Google API
I Have google api link from two locations 我有来自两个位置的Google API链接
http://maps.googleapis.com/maps/api/directions/json?&mode=driving&origin=12.9862449,80.2094988&destination=12.9229153,80.1274558&sensor=false http://maps.googleapis.com/maps/api/directions/json?&mode=driving&origin=12.9862449,80.2094988&destination=12.9229153,80.1274558&sensor=false
i get the response from two locations(distance&time) its working fine, but we need with traffic and without traffic details using google api's. 我从两个位置(距离和时间)得到了响应,但工作正常,但是我们需要使用Google API的有流量且无流量详细信息。
https://developers.google.com/maps/documentation/distance-matrix/intro?hl=en#RequestParameters https://developers.google.com/maps/documentation/distance-matrix/intro?hl=zh-CN#RequestParameters
For requests where the travel mode is transit: You can optionally specify one of departure_time or arrival_time.
对于出行方式为中转的请求:您可以选择指定“ description_time”或“ arrival_time”之一。 If neither time is specified, the departure_time defaults to now (that is, the departure time defaults to the current time).
如果两个时间都未指定,则department_time默认为现在(即,出发时间默认为当前时间)。
For requests where the travel mode is driving: You can specify the departure_time to receive a route and trip duration (response field: duration_in_traffic) that take traffic conditions into account.
对于行驶模式为行驶的请求:您可以指定离开时间,以接收考虑了交通状况的路线和行程持续时间(响应字段:duration_in_traffic)。 This option is only available if the request contains a valid API key, or a valid Google Maps APIs Premium Plan client ID and signature.
仅当请求包含有效的API密钥或有效的Google Maps APIs Premium Plan客户端ID和签名时,此选项才可用。 The departure_time must be set to the current time or some time in the future.
离场时间必须设置为当前时间或将来的某个时间。 It cannot be in the past.
它不可能过去。
traffic_model (defaults to best_guess) — Specifies the assumptions to use when calculating time in traffic.
traffic_model(默认为best_guess)—指定在计算流量时间时要使用的假设。 This setting affects the value returned in the duration_in_traffic field in the response, which contains the predicted time in traffic based on historical averages.
此设置影响响应中的duration_in_traffic字段中返回的值,该值包含基于历史平均值的流量预测时间。 The traffic_model parameter may only be specified for requests where the travel mode is driving, and where the request includes a departure_time, and only if the request includes an API key or a Google Maps APIs Premium Plan client ID.
仅当行驶模式为行驶,且请求包含“ department_time”且仅在请求包含API密钥或Google Maps APIs Premium Plan客户端ID的情况下,才可以指定traffic_model参数。 The available values for this parameter are: best_guess (default) indicates that the returned duration_in_traffic should be the best estimate of travel time given what is known about both historical traffic conditions and live traffic.
该参数的可用值为:best_guess(默认值),表示在已知历史交通状况和实时交通的情况下,返回的duration_in_traffic应该是旅行时间的最佳估计。 Live traffic becomes more important the closer the departure_time is to now.
出发时间离现在越近,实时交通变得越来越重要。
pessimistic indicates that the returned duration_in_traffic should be longer than the actual travel time on most days, though occasional days with particularly bad traffic conditions may exceed this value.
悲观的表示在大多数情况下,返回的duration_in_traffic应该长于实际旅行时间,尽管有时交通状况特别糟糕的日子可能会超过此值。
optimistic indicates that the returned duration_in_traffic should be shorter than the actual travel time on most days, though occasional days with particularly good traffic conditions may be faster than this value.
乐观表示在大多数情况下,返回的duration_in_traffic应该短于实际旅行时间,尽管有时交通状况特别好的日子可能比此值快。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.