I noticed when using the Google Directions API web service when the request contains more than 1 leg the response does not include the duration in traffic information. With 1 leg requests the duration in traffic is present in the response. Why is this?
https://maps.googleapis.com/maps/api/directions/json?origin=50.7963874022473,-1.12215042114258&destination=50.8525337185711,-1.17932204157114&waypoints=50.7921245679458,-1.13072438976753&mode=driving&departure_time=1452940200&traffic_model=pessimistic&units=imperial&key=myKey
In the above request no Duration in traffic but in the below request
https://maps.googleapis.com/maps/api/directions/json?origin=50.7963874022473,-1.12215042114258&destination=50.8525337185711,-1.17932204157114&mode=driving&departure_time=1452940200&traffic_model=pessimistic&units=imperial&key=myApi
The duration In Traffic is present.
您可以在viapoint前面加上路途前缀:这将仅返回一条腿并返回响应,并将持续时间包括在traffic字段中(只要包括correc参数即可)。
https://developers.google.com/maps/documentation/directions/intro?hl=en
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.