Click here to Skip to main content
15,921,660 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
i have following code which plot all marker at same time on map...
but i want to plot those marker after some time interval like 2 or 5 second..
give me some idea..
Thank you !!!

Here is my code...

map.aspx page :

<script src="" 
  <script type="text/javascript" src=""></script>
  <script type="text/javascript" charset="UTF-8" src=""></script>
 <script type="text/javascript">
    var locations = [<%=data%>];
    var map = new google.maps.Map(document.getElementById('map'), {
      zoom: 15,
      center: new google.maps.LatLng(<%=slat%>, <%=slong%>),
      mapTypeId: google.maps.MapTypeId.ROADMAP

    var infowindow = new google.maps.InfoWindow();
    var marker, i;

    for (i = 0; i < locations.length; i++) {  
      marker = new google.maps.Marker({
        position: new google.maps.LatLng(locations[i][1], locations[i][2]),
        animation: google.maps.Animation.DROP,
        map: map
      google.maps.event.addListener(marker, 'click', (function(marker, i) {
        return function() {
, marker);
      })(marker, i));

map.aspx.cs page :

protected void Page_Load(object sender, EventArgs e)
        SqlDataAdapter adp = new SqlDataAdapter("select lat,long from data", con);
        DataTable dt = new DataTable();
        if (dt.Rows.Count > 0)
            int cnt = dt.Rows.Count;
            int j = dt.Rows.Count / 2;
            slat = dt.Rows[j]["lat"].ToString();
            slong = dt.Rows[j]["long"].ToString();

            for (int i = 0; i < dt.Rows.Count; i++)
                data += "['navsari'," + dt.Rows[i]["lat"].ToString() + "," + dt.Rows[i]["long"].ToString() + "]";
                data += ",";

        data = data.TrimEnd(',');
Updated 5-Nov-12 1:13am
ZurdoDev 5-Nov-12 8:51am    
in you JS you can use the setTimeout method and then call a function that just plots the marker.
Member 9332883 6-Nov-12 0:12am    
i have try that...but it plot all marker at same time..
i want to plot markers one by one after some time of interval...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900