简体   繁体   English

使用Google API的iOS中两个位置(纬度和经度)之间的估计时间

[英]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.

相关问题 是否有IOS API来包装Google“两个位置之间的距离” API? - Is there an IOS API that wraps the google 'distance between two locations' API? 如何使用谷歌计算两个位置之间的距离 api in swift 4 - How to calculate distance between two locations using google api in swift 4 如何在谷歌地图iOS swift中绘制两个位置之间的路线 - How to draw routes between two locations in google maps iOS swift 如何使用Google Map API在iOS 6中的2个位置之间绘制路线? - How to use Google Map API to draw route between 2 locations in iOS 6? 如何在iOS中的两个位置之间获取路线? - How to get route between two locations in iOS? 如何知道Google Maps iOS SDK上两个位置之间的每个路线位置 - How to know each route position between two locations on Google map iOS sdk iOS,如何使用Google Places Api显示两点之间的路线? - iOS, how to display route between two points using Google Places Api? 如何在iOS中使用GoogleMaps GMSCamera更新或更改两个位置之间的相机位置? - How to Update or Change Camera Position between two Locations using GoogleMaps GMSCamera in iOS? 如何使用mapView和CLLocationManager在iOS Swift中的两个位置之间绘制方向 - How to plot Directions between two locations in iOS Swift using mapView and CLLocationManager 如何在iOS中使用Google Map API获取mapView上触摸位置的纬度和经度 - How to get the latitude & longitude of a touch location on mapView using Google map API in iOS
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM