title: draw polyline between multiple markers
body: <p>i have solved the problem of placing multiple marker in google map.<br>
  now i have face the problem to draw a polyline between this markers.actually i am new to google map api.<br>
  <code>my code:</code>  </p>
  
  <p>value of <code>$lat1</code> is<br>
  <code>[["a, Ahmedabad, Gujarat 380001, India","23.0263517","72.5819013"],<br>
    ["b, Ahmedabad, Gujarat, India","23.0690035","72.6801576"],
    ["c, Ahmedabad, Gujarat 380015, India","23.0171240","72.5330533"]]</code></p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
    var markerarray=new Array();
   var locations = &lt;?php echo json_encode($lat1);?&gt;;
   var directionsService = new google.maps.DirectionsService();
   var map = new google.maps.Map(document.getElementById('map'), {
   zoom: 10,
   center: new google.maps.LatLng(23.0171240, 72.5330533),
   mapTypeId: google.maps.MapTypeId.ROADMAP
  });
  
  var infowindow = new google.maps.InfoWindow();
  
  var marker, i;
  for (i = 0; i &lt; locations.length; i++) 
  { 
    marker = new google.maps.Marker({
      position: new google.maps.LatLng(locations[i][1], locations[i][2]),
  
      map: map
     });
  
   markerarray[i] = (Array(locations[i][1], locations[i][2]));
  
    google.maps.event.addListener(marker, 'click', (function(marker, i) {
      return function() {
        infowindow.setContent(locations[i][0]);
        infowindow.open(map, marker);
      }
    })(marker, i));
  } 
  
  var flightPath = new google.maps.Polyline({
    path: markerarray,
    geodesic: true,
    strokeColor: '#FF0000',
    strokeOpacity: 1.0,
    strokeWeight: 2
  });
  
  flightPath.setMap(map);
  &lt;/script&gt; 
  </code></pre>
  
  <p>I draw polyline using static value.but no success with dynamic value.<br>
  i use this example for draw polyline.but i have no idea how to use it with multiple markers.</p>
  
  <p><a href="https://developers.google.com/maps/documentation/javascript/examples/polyline-simple" rel="nofollow">Simple Polylines</a></p>
  
  <p>Thanks in advance.</p>