问题
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