简体   繁体   English

如何使用MSExcel中的纬度和经度对在Google地图上移动标记并每10秒刷新一次

[英]How can I move a marker on Google Maps using latitude & longitude pair from MSExcel and refresh every 10 seconds

This is my code: it's retrieving data from excel database and i have to move the marker by taking one by one co-ordinate from excel.it is actually for bus tracking.i already have all the co-ordinates in latitude-longitude format. 这是我的代码:它正在从excel数据库中检索数据,我必须通过从excel逐个获取一个坐标来移动标记。它实际上是用于公交车跟踪的。我已经具有所有经度-纬度格式的坐标。 Just to retrieve the values by jsp and place the values one by one in javascript by placing the new marker,i also want to delete the old marker.pls help 只是通过jsp检索值,然后通过放置新标记将这些值一个一地放置在javascript中,我也想删除旧标记。pls帮助

 <%response.setIntHeader("Refresh", 5);
 Connection conn=null;
 Statement stmt=null;
      String sql="";
     ResultSet rs=null;
     Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
      conn=DriverManager.getConnection("jdbc:odbc:kashimiraz","","");
       stmt=conn.createStatement(
      ResultSet.TYPE_SCROLL_INSENSITIVE,
        ResultSet.CONCUR_UPDATABLE);
         sql="select * from [Sheet1$]";
       rs=stmt.executeQuery(sql);
       rs.next();
          String latitude =rs.getString("lat");
        String longitude = rs.getString("lon");
      String last = latitude;
        String lastt= longitude;
       rs.close();
       stmt.close();
        conn.close();
        rs=null;
        stmt=null;
   conn=null;  %>
        <script type="text/javascript">
        function initialize()
   {
      var value="<%=last%>";
      var valuee="<%=lastt%>";
          var myCenter=new google.maps.LatLng(value,valuee);
    var mapProp = {
        center:myCenter,
         zoom:15,
       mapTypeId:google.maps.MapTypeId.ROADMAP
          };
           var map=new google.maps.Map(document.getElementById("googleMap"),mapProp);
         var marker=new google.maps.Marker({
       position:myCenter,
          });
     marker.setMap(map);
    var infowindow = new google.maps.InfoWindow({
      content:"Bus# 57"
         });
      infowindow.open(map,marker);
      }google.maps.event.addDomListener(window, 'load', initialize);
     </script>
    <div id="googleMap" style="width:1200px;height:500px;"></div>
     </section>
          </body></html>

I think your answer is here: http://www.w3schools.com/js/js_timing.asp 我认为您的答案在这里: http : //www.w3schools.com/js/js_timing.asp

use setInterval example: setInterval(function(){alert("Hello")},3000); 使用setInterval示例: setInterval(function(){alert("Hello")},3000);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 当网络服务中的经度和纬度发生变化时,如何在Google地图中移动标记? - How to move the marker in Google map when the latitude and longitude changes in webservices? 如何从具有多个经度和纬度坐标的JSON文件中创建Google Maps标记 - How can I create google maps markers from a JSON file with multiple latitude and longitude coordinates 当我从短信中接收经度和纬度时,如何在Google地图中添加标记 - How to add marker in google map when i recieve longitude and latitude from sms 如何从我在地图上设置的标记保存经度和纬度 - How to save longitude and latitude from the marker i set on the map 每秒在谷歌地图中添加新标记 - Add new marker in google maps every seconds 我想通过从json获取经度和纬度在Google地图上显示标记 - i want to show marker on google map by getting longitude and latitude from json 如何从 Google 地图中的可拖动标记中获取 position? - How can I get position from a draggable marker in Google Maps? 谷歌地图不返回经度和纬度 - Google maps not returning longitude and latitude 如何在Google Map v2中获取标记的经度和纬度值 - How to get the longitude and latitude value of the marker in google map v2 如何使用 Google 的 GeoCoder Java Client 获取特定地点的经度和纬度? - How can I get the longitude and latitude of a specific place using Google's GeoCoder Java Client?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM