Phuket IT

Computer => Web Site => Topic started by: admin on 24, 08, 2013, 09:13:20

Title: Google Maps JS API v3 - Simple multiple marker + polyline
Post by: admin on 24, 08, 2013, 09:13:20
Google Maps JS API v3 - Simple multiple marker + polyline
(http://www.codeproject.com/KB/custom-controls/Google-Maps-User-Control/MapWithPolyline.JPG)

Code: [Select]

var arr = [];
for (var i = 0; i < locations.length; i++) { 
    var marker = new google.maps.Marker({
      position: new google.maps.LatLng(locations[i][0], locations[i][1]),
      map: map
    });
    arr.push(marker.getPosition());

  // <-- snipped -->
}

Edit:

  var poly = new google.maps.Polyline({
      path: arr,
      strokeColor: '#000000',
      strokeOpacity: 1.0,
      strokeWeight: 3,
      map: map   
    });




ref - http://stackoverflow.com/questions/16169775/google-maps-js-api-v3-simple-multiple-marker-polyline