-1

enter image description here I am new to google api. Please help me to use Google map poly-line API by passing array of coordinates dynamically?

Abhishek T.
  • 1,133
  • 1
  • 17
  • 33
Atul
  • 17
  • 2

1 Answers1

0

make array of latlng and then use that array path in polyline obj

var latlngArray = [[lat,lng],[lat,lng],[lat,lng],[lat,lng]];
var patharray = [];
for (var i = 0;i<latlngArray .length ;i++){
patharray.push(new google.maps.LatLng(latlngArray[i][0],latlngArray[i][1]));
}
var tourplan = new google.maps.Polyline({
        path : patharray ,
        strokeColor : "#0000FF",
        strokeOpacity : 0.6,
        strokeWeight : 2,
 });
tourplan.setMap(map)
Akshay
  • 815
  • 7
  • 16
  • Thanks Akshay. I want to pass the coordinates from oracle database in Java Dynamic web project. Can you please give me a rough idea how to get it done. – Atul Jul 29 '16 at 05:16