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?
Asked
Active
Viewed 421 times
-1
-
Pictures of code are not useful, please provide a [mcve] that demonstrates the issue. – geocodezip Jul 28 '16 at 10:34
1 Answers
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