5

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

Dan Goldin
  • 957
  • 13
  • 32

1 Answers1

3

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.

geocodezip
  • 158,664
  • 13
  • 220
  • 245
  • Maybe I phrased it poorly. I want the directions text to be displayed in a div like so- directionsDisplay.setPanel(document.getElementById("directions-panel")); Won't calling it multiple times overwrite it? I guess I can just have it write into 3 different divs for each call. – Dan Goldin Jun 04 '13 at 20:54
  • That would be the option for "different DirectionRenderer objects for the different pieces". If you combine the responses together and pass them to a single DirectionsRenderer, you would only need one (I haven't done that, but it is conceptually possible). – geocodezip Jun 04 '13 at 21:17
  • Here's what I was able to do by just duplicating the renderers: http://dangoldin.com/citibike-station-directions/ I know it's not perfect and a bit crude but I'll keep on working on it. – Dan Goldin Jun 04 '13 at 22:43