karthika pommudu

karthika pommudu

  • NA
  • 321
  • 35k

How to zoom map...

Feb 23 2019 5:52 AM
var i,j;
var icon = "Markers/letter_m.png";
//var icon = "Markers/letter_m.png";
var bounds = new google.maps.LatLngBounds();
for (i = 0; i < v.length; i++) {
var loc = v[i];
var reg = arraylorry[i];
var spdval = spdarr[i];
var t_disval = t_dis[i];
var up_dateval = up_date[i];
var statusval = statusval1[i];
//console.log(data);
// for (var j = 0; j < v.length; j++) {
var content = "<div class='map_marker'><div style=font-weight:bold;><span>Lorry Number :</span>"+reg+ "</div><div class='lorry_name'><span>Location:</span>"+loc+ "</div><div><span>Speed:</span>"+spdval+ "</div><div><span>Today_Distance:</span>"+t_disval+ "</div><div><span>Update:</span>"+up_dateval+ "</div><div><span>Status:</span>"+statusval+ "</div>";
var infoWindow = new google.maps.InfoWindow({
content: content
});
var marker = new google.maps.Marker({
position: new google.maps.LatLng(parseFloat(js_lats[i]), parseFloat(js_longs[i])),
icon:icon,
map:map
});
/*marker.addListener('click', function() {
infowindow.open(map, marker);
});*/
google.maps.event.addListener(marker,'click', (function(marker,content,infoWindow){
return function() {
infoWindow.setContent(content);
infoWindow.open(map,marker);
};
})(marker,content,infoWindow));
}
map.fitBounds(bounds);
google.maps.event.addDomListener(window, "load");

Answers (1)