title: Draw line in google maps
body: <p>I try to draw a line in google maps, i try this code and nothing happen only the marker are there not the line, i already read some reference like <a href="https://developers.google.com/maps/documentation/javascript/v2/overlays#Icons_overview" rel="nofollow">https://developers.google.com/maps/documentation/javascript/v2/overlays#Icons_overview</a>
  and try the code but the line still doesn't come out, anyone can help me?
  below are my code, assume address are array</p>
  
  <pre><code>for (var i = 0; i &lt; address.length; i++) {
      geocoder.geocode({ 'address': address[i] }, function (results, status) {
          if (status == google.maps.GeocoderStatus.OK) {
  
              if (i == 2) {
                  var pos1 = results[0].geometry.location;
                  alert(pos1);
              }
  
              else if (i == 2) {
                  var pos2 = results[0].geometry.location;
                  alert(pos2);
              }
  
              map.setCenter(results[0].geometry.location);
              var marker = new google.maps.Marker
              (
                  {
                      position: results[0].geometry.location,
                      map: map,
                      title: 'click me'
                  }
              );
              var infowindow = new google.maps.InfoWindow
              (
                  {
                      content: '&lt;img src="http://wallpaperscraft.com/image/child_girl_emotion_sweet_face_25641_100x100.jpg"&gt; Welcome to origineit'
                  }
              );
              var flightPlanCoordinates = [
                  new google.maps.LatLng(pos1),
                  new google.maps.LatLng(pos2)
                ];
  
              if (i == 2) {
  
                  var polyline = new google.maps.Polyline
                  ({
                      path: flightPlanCoordinates,
                      strokeColor: '#FF0000',
                      strokeOpacity: 0.8,
                      strokeWeight: 3
                  });
                  polyline.setMap(map);
              }
  
              google.maps.event.addListener(marker, 'click', function () {
                  // Calling the open method of the infoWindow 
                  infowindow.open(map, marker);
              });
          }
          else {
              alert('Geocode was not successful for the following reason: ' + status);
          }
      });
  }
  </code></pre>