0 Members and 1 Guest are viewing this topic.

AuthorTopic: Google Maps JS API v3 - Simple multiple marker + polyline  (Read 1909 times)

Offline admin

  • Administrator
  • Hero Member
  • *****
  • Posts: 667
  • Total Like : 0
    • https://www.facebook.com/pages/Phuket-ITcom/148070628616802
    • https://www.youtube.com/channel/UCq5x3hDkhcqJU4QXOE5adTQ
    • Email
« on: 24, 08, 2013, 09:13:20 »
Google Maps JS API v3 - Simple multiple marker + polyline


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