Adding multiple directions requests together Google Maps API

霸气de小男生 提交于 2019-12-11 11:52:31

问题


I'm trying to get directions for a user provided origin and destination, while showing directions to a middle location for ALL travel modes (driving, walking, bicycling, transit).

I have this coded using waypoints, but I just discovered that the Google Maps API doesn't support waypoints for public transit--as discussed in a previous question here.

I'm having difficulty finding any examples for how to go about piecing together multiple directions requests without using waypoints. Is there a way to add multiple directions to the directionsDisplay variable?

Example: Display directions from A -> B, then add directions from B -> C to the existing display.


回答1:


Found my answer based on this question: Multiple travel modes to render one map using google maps API

Multiple directionsDisplays are needed, with multiple trip legs (requests) being sent to directionsService.route().



来源:https://stackoverflow.com/questions/29615509/adding-multiple-directions-requests-together-google-maps-api

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