google mapps in asp.net using javascript

1 posts, 0 answers
  1. Vishwateja
    Vishwateja avatar
    3 posts
    Member since:
    Jan 2014

    Posted 16 Jan 2014 Link to this post

    displaying google points using markers in java script and drawing line between all markers but problem is i want display one by one marker using set timer here is my code where should i write set time in my code please replay me thank you in advance  .


      var map;
           var myVar;
           var flightPlanArray = [];

           initialize();

           function initialize() {
           var markers = JSON.parse('<%#ConvertDataTabletoString() %>');
         
        
           var mapOptions = {
                center: new google.maps.LatLng(markers[0].Latitude, markers[0].Longitude),
                zoom: 5,
                mapTypeId: google.maps.MapTypeId.ROADMAP
           }

            map = new google.maps.Map(document.getElementById("map_canvas"), mapOptions);
          
         
            for (i = 0; i < markers.length; i++) {
                data = markers[i]
                var myLatlng = new google.maps.LatLng(data.Latitude, data.Longitude);
                var image = 'images/YellowCar.png'
                var marker = new google.maps.Marker({
                    position: myLatlng,
                    map: map,
                     icon: image
                  });
                 (function(map,  data) {
                    for (var i = 0; i < markers.length; i++) {
                        data = markers[i]
                        
                        var myLatLng = new google.maps.LatLng(data.Latitude, data.Longitude);
                        var marker = new google.maps.Marker({
                            position: myLatLng,
                            map: map,

                        });
                        
                        //data=setInterval(function(data){initialize()},1000);
                       // function marker() {alert('Hi')}setTimeout(marker, 1000)
                        flightPlanArray.push(myLatLng);
                       
                      }iterator++;
                     
                    drawFlightPlan(flightPlanArray);
              
              
                /* Draw lines between all markers */
                function drawFlightPlan(flightPlanCoordinates) {
            
                    var flightPath = new google.maps.Polyline({
                        path: flightPlanCoordinates,
                        geodesic: true,
                        strokeColor: "#ad1700",
                        strokeOpacity: 1.0,
                        strokeWeight: 2

                    });
                       
                        // To add the marker to the map, call setMap();

                    /* Bind the new flightPath to the map */
                    flightPath.setMap(map);
                    fitBounds(flightPlanCoordinates);
                }
                  })(map, data)
            }
         }

Back to Top