Ali Asad Sahu
Ali Asad Sahu

Reputation: 57

Plotting two routes at same time with google maps api

Is it possible to plot two routes at same time with Google maps api. For Example

Route from city A to B
and Route from city C to D

In this case A,B and C,D are separated.

Thanks.

Upvotes: 0

Views: 4325

Answers (1)

Heitor Chang
Heitor Chang

Reputation: 6057

Here are two polylines on the same map; there doesn't appear to be a limit.

http://jsfiddle.net/Lqcde/3/

I didn't add the div panels (becomes too cluttered) but you can also show two sets of text directions. It's a bit confusing because both start points are shown as "A" and endpoints, "B". Add the following lines:

directionsDisplay.setPanel(document.getElementById("dir-1"));
directionsDisplay2.setPanel(document.getElementById("dir-2"));

<div id="dir-1"></div>
<div id="dir-2"></div>

Upvotes: 3

Related Questions