How can I get directions for multiple waypoints with different transit methods using the Google Directions Service?

陌路散爱 提交于 2019-12-22 07:00:25

问题


So I understand how to use the Google Directions service to add waypoints and to change the transit mode but is it possible to do both with the same API call?

I'm trying to get directions that will involve walking, then biking, and then some more walking but I'm not sure how to do it using one API call. I know I can split it up into a few but it will then force me to process Google's response vs using the setDirections method.

These are the docs I'm going from: https://developers.google.com/maps/documentation/javascript/directions


回答1:


but is it possible to do both with the same API call?

Not at present.

it will then force me to process Google's response vs using the setDirections method.

Why do you say that? Unless you want to do something special, you should be able to use the DirectionsRenderer to display the results from multiple calls to the DirectionsService either by combining them or using different DirectionRenderer objects for the different pieces.



来源:https://stackoverflow.com/questions/16926928/how-can-i-get-directions-for-multiple-waypoints-with-different-transit-methods-u

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!