TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
karthika pommudu
NA
321
35k
how to loop this ...help to find
Feb 12 2019 11:04 PM
Here I need to set move maker in map but in this loop only show the last marker in loop.Help to find this thanks by advance
$result1=$conn->query("Query is here ");
// $row = $result1->fetch_assoc();
$rows = [];
while($row = mysqli_fetch_array($result1))
{
$rows[] = $row;
$src_city1 = $row['latitude'];
$src_city2 = $row['longitude'];
$src_city3 = $row['location'];
$src_city5 = $row['registration_no'];
//echo $src_city5;
?> //echo $src_city2;
var src_city1 = <?php echo $src_city1; ?>;
var src_city2 = <?php echo $src_city2; ?>;
var src_city3 = '<?php echo $src_city3; ?>';
var src_city5 = '<?php echo $src_city5; ?>';
initialize(src_city1,src_city2,src_city3,src_city5);
<?php
}
?>
var map, marker;
var startPos = [src_city1,src_city2];
var speed = 50; // km/h
var delay = 100;
function animateMarker(marker, coords, km_h)
{
var target = 0;
var km_h = km_h || 50;
coords.push([startPos[0], startPos[1]]);
var spherical;
var computeDistanceBetween;
function goToPoint()
{
var lat = marker.position.lat();
var lng = marker.position.lng();
var step = (km_h * 1000 * delay) / 3600000;
var dest = new google.maps.LatLng(
coords[target][0], coords[target][1]);
var distance = google.maps.geometry.spherical.computeDistanceBetween(dest, marker.position);
var numStep = distance / step;
var i = 0;
var deltaLat = (coords[target][0] - lat) / numStep;
var deltaLng = (coords[target][1] - lng) / numStep;
function moveMarker()
{
lat += deltaLat;
lng += deltaLng;
i += step;
if (i < distance)
{
marker.setPosition(new google.maps.LatLng(lat, lng));
setTimeout(moveMarker, delay);
}
else
{ marker.setPosition(dest);
target++;
if (target == coords.length){ target = 0; }
setTimeout(goToPoint, delay);
}
}
moveMarker();
}
goToPoint();
}
function initialize(src_city1,src_city2,src_city3,src_city5)
{
var myOptions = {
zoom: 14,
center: new google.maps.LatLng(src_city1,src_city2),
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var markers = [
{
"title": 'TN69AP3333',"description":'+ src_city1+',"description1":'Active',"description2":'Active',"icons": "Markers/direction_icon.png","icon": "Markers/letter_m.png"
}];
map = new google.maps.Map(document.getElementById("dvMap"), myOptions);
for (var i = 0; i < markers.length; i++) {
var data = markers[i]
var icon = "Markers/letter_m.png";
var infoWindow = new google.maps.InfoWindow();
var data = markers;
var data1 = data.description;
marker = new google.maps.Marker({
position: new google.maps.LatLng(src_city1,src_city2),
map: map,
icon:icon,
// title: data.title,
// icon: data.icon,
//icons: data.icons
});
//*****************
//var device = 'Track-ID:"LMPLY0011"';
(function (marker, data){
google.maps.event.addListener(marker, "click", function (e) {{
if(src_city3 !='')
{
var src_city = 'OFF';
infoWindow.setContent("<div class='map_marker'><div class='lorry_name'><span>Lorry Number :</span>"+src_city5+"</div><div class='status_inactive'><span>Engine :</span>" + src_city+ "</div><div><span>Location :</span>"+src_city3+"</div></div>");
}
else
{
var src_city1 = 'on';
infoWindow.setContent("<div class='map_marker'><div class='map_marker'><div class='lorry_name'><span>Lorry Number :</span>"+src_city5+"</div><div class='status_active'><span>Engine :</span>" + src_city1+ "</div></div><div'><span>Location :</span>"+src_city3+"</div></div>");
}
infoWindow.open(map, marker);
}});})(marker, data);
}
//**************
google.maps.event.addListenerOnce(map, 'idle', function()
{
setInterval(marker, [
[src_city1, src_city2]
], 1000);
});
}
// initialize();
Reply
Answers (
0
)
generate pdf is not diplay like my actual code
Remove space between table border and heading