久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

      <tfoot id='CmiIo'></tfoot>
      <legend id='CmiIo'><style id='CmiIo'><dir id='CmiIo'><q id='CmiIo'></q></dir></style></legend>

        <small id='CmiIo'></small><noframes id='CmiIo'>

      1. <i id='CmiIo'><tr id='CmiIo'><dt id='CmiIo'><q id='CmiIo'><span id='CmiIo'><b id='CmiIo'><form id='CmiIo'><ins id='CmiIo'></ins><ul id='CmiIo'></ul><sub id='CmiIo'></sub></form><legend id='CmiIo'></legend><bdo id='CmiIo'><pre id='CmiIo'><center id='CmiIo'></center></pre></bdo></b><th id='CmiIo'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='CmiIo'><tfoot id='CmiIo'></tfoot><dl id='CmiIo'><fieldset id='CmiIo'></fieldset></dl></div>

          <bdo id='CmiIo'></bdo><ul id='CmiIo'></ul>

        地理位置:僅移動谷歌地圖標記而不重新加載地圖

        Geolocation: moving only google maps marker without reload the map(地理位置:僅移動谷歌地圖標記而不重新加載地圖)
        <i id='Jc3yw'><tr id='Jc3yw'><dt id='Jc3yw'><q id='Jc3yw'><span id='Jc3yw'><b id='Jc3yw'><form id='Jc3yw'><ins id='Jc3yw'></ins><ul id='Jc3yw'></ul><sub id='Jc3yw'></sub></form><legend id='Jc3yw'></legend><bdo id='Jc3yw'><pre id='Jc3yw'><center id='Jc3yw'></center></pre></bdo></b><th id='Jc3yw'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='Jc3yw'><tfoot id='Jc3yw'></tfoot><dl id='Jc3yw'><fieldset id='Jc3yw'></fieldset></dl></div>

            <tbody id='Jc3yw'></tbody>
          <tfoot id='Jc3yw'></tfoot>

            • <bdo id='Jc3yw'></bdo><ul id='Jc3yw'></ul>

                <legend id='Jc3yw'><style id='Jc3yw'><dir id='Jc3yw'><q id='Jc3yw'></q></dir></style></legend>
                1. <small id='Jc3yw'></small><noframes id='Jc3yw'>

                  本文介紹了地理位置:僅移動谷歌地圖標記而不重新加載地圖的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我只需要在設備移動或設備變得更準確時更新標記.當位置變化時也重新加載地圖,我只需要移動制造商.我有以下代碼:

                  I need to update only the marker when the device is moving or when the device is getting more accuracy. When the position change also reload the map and I need to move only the maker. I have the following code:

                  if (navigator.geolocation) {
                      navigator.geolocation.watchPosition(
                  
                      function(position){
                      var latitude = position.coords.latitude;
                      var longitude = position.coords.longitude;
                      var accuracy = position.coords.accuracy;
                      var coords = new google.maps.LatLng(latitude, longitude);
                      var mapOptions = {
                          zoom: 20,
                          center: coords,
                          streetViewControl: false,
                          mapTypeControl: false,
                          navigationControlOptions: {
                              style: google.maps.NavigationControlStyle.SMALL
                          },
                          mapTypeId: google.maps.MapTypeId.ROADMAP
                          };
                  
                       var capa = document.getElementById("capa");
                       capa.innerHTML = "latitud: " + latitude + " longitud: " + "   aquesta es la precisio en metres  :  " + accuracy;  
                  
                          map = new google.maps.Map(
                              document.getElementById("mapContainer"), mapOptions
                              );
                          var marker = new google.maps.Marker({
                                  position: coords,
                                  map: map,
                                  title: "ok"
                          });
                  
                  
                      },function error(msg){alert('Please enable your GPS position future.');  
                  
                    }, {maximumAge:0, timeout:5000, enableHighAccuracy: false});
                  
                  }else {
                      alert("Geolocation API is not supported in your browser.");
                  }
                  

                  謝謝!

                  推薦答案

                  我認為問題在于你在 watchPosition 函數中創建了一個新地圖.您只需要創建一個標記,然后在 watchPosition 函數中更新其位置.

                  I believe that the problem is that you create a new map inside the watchPosition function. You only need to create one marker and then update its position inside the watchPosition function.

                  navigator.geolocation.watchPosition(
                      function (position) {
                          setMarkerPosition(
                              currentPositionMarker,
                              position
                          );
                      });
                  
                  function setMarkerPosition(marker, position) {
                      marker.setPosition(
                          new google.maps.LatLng(
                              position.coords.latitude,
                              position.coords.longitude)
                      );
                  }
                  

                  也許這個例子會對你有所幫助:

                  Maybe this example will help you:

                  <!doctype html>
                  <html lang="en">
                  
                      <head>
                          <title>Google maps</title>
                          <script src="http://code.jquery.com/jquery-1.8.2.min.js"></script>
                          <script type="text/javascript" src="http://maps.google.com/maps/api/js?v=3&sensor=false&language=en"></script>
                          <script type="text/javascript">
                  
                              var map,
                                  currentPositionMarker,
                                  mapCenter = new google.maps.LatLng(40.700683, -73.925972),
                                  map;
                  
                              function initializeMap()
                              {
                                  map = new google.maps.Map(document.getElementById('map_canvas'), {
                                     zoom: 13,
                                     center: mapCenter,
                                     mapTypeId: google.maps.MapTypeId.ROADMAP
                                   });
                              }
                  
                              function locError(error) {
                                  // the current position could not be located
                                  alert("The current position could not be found!");
                              }
                  
                              function setCurrentPosition(pos) {
                                  currentPositionMarker = new google.maps.Marker({
                                      map: map,
                                      position: new google.maps.LatLng(
                                          pos.coords.latitude,
                                          pos.coords.longitude
                                      ),
                                      title: "Current Position"
                                  });
                                  map.panTo(new google.maps.LatLng(
                                          pos.coords.latitude,
                                          pos.coords.longitude
                                      ));
                              }
                  
                              function displayAndWatch(position) {
                                  // set current position
                                  setCurrentPosition(position);
                                  // watch position
                                  watchCurrentPosition();
                              }
                  
                              function watchCurrentPosition() {
                                  var positionTimer = navigator.geolocation.watchPosition(
                                      function (position) {
                                          setMarkerPosition(
                                              currentPositionMarker,
                                              position
                                          );
                                      });
                              }
                  
                              function setMarkerPosition(marker, position) {
                                  marker.setPosition(
                                      new google.maps.LatLng(
                                          position.coords.latitude,
                                          position.coords.longitude)
                                  );
                              }
                  
                              function initLocationProcedure() {
                                  initializeMap();
                                  if (navigator.geolocation) {
                                      navigator.geolocation.getCurrentPosition(displayAndWatch, locError);
                                  } else {
                                      alert("Your browser does not support the Geolocation API");
                                  }
                              }
                  
                              $(document).ready(function() {
                                  initLocationProcedure();
                              });
                  
                          </script>
                      </head>
                  
                      <body>
                          <div id="map_canvas" style="height:600px;"></div>
                      </body>
                  
                  </html>
                  

                  這篇關于地理位置:僅移動谷歌地圖標記而不重新加載地圖的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  Use IScroll in Angular 2 / Typescript(在 Angular 2/Typescript 中使用 IScroll)
                  anime.js not working in Ionic 3 project(Anime.js 在 Ionic 3 項目中不起作用)
                  Ionic 3 - Update Observable with Asynchronous Data(Ionic 3 - 使用異步數據更新 Observable)
                  Angular 2: file not found on local .json file(Angular 2:在本地 .json 文件中找不到文件)
                  In Ionic 2, how do I create a custom directive that uses Ionic components?(在 Ionic 2 中,如何創建使用 Ionic 組件的自定義指令?)
                  Use ViewChild for dynamic elements - Angular 2 amp; ionic 2(將 ViewChild 用于動態元素 - Angular 2 amp;離子2)

                  <tfoot id='xA9Hj'></tfoot>

                      <tbody id='xA9Hj'></tbody>
                    <i id='xA9Hj'><tr id='xA9Hj'><dt id='xA9Hj'><q id='xA9Hj'><span id='xA9Hj'><b id='xA9Hj'><form id='xA9Hj'><ins id='xA9Hj'></ins><ul id='xA9Hj'></ul><sub id='xA9Hj'></sub></form><legend id='xA9Hj'></legend><bdo id='xA9Hj'><pre id='xA9Hj'><center id='xA9Hj'></center></pre></bdo></b><th id='xA9Hj'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='xA9Hj'><tfoot id='xA9Hj'></tfoot><dl id='xA9Hj'><fieldset id='xA9Hj'></fieldset></dl></div>
                    • <small id='xA9Hj'></small><noframes id='xA9Hj'>

                      <legend id='xA9Hj'><style id='xA9Hj'><dir id='xA9Hj'><q id='xA9Hj'></q></dir></style></legend>

                          • <bdo id='xA9Hj'></bdo><ul id='xA9Hj'></ul>
                          • 主站蜘蛛池模板: 成人区精品一区二区婷婷 | xxxxxx国产| 国产精品久久久久久久午夜 | av片在线观看网站 | 久久机热| 久久久久久国模大尺度人体 | 亚洲日本视频 | 黄色永久免费 | 一级黄色片美国 | 日本韩国电影免费观看 | 久久99精品久久久久久 | 日韩性在线 | 夜夜爽99久久国产综合精品女不卡 | 国产精品久久久久久婷婷天堂 | 伊人一区 | 成人福利网 | 亚洲午夜精品 | 久久久91 | 污免费网站 | 亚洲精品毛片av | www.日日干| 免费观看一级视频 | 羞羞视频在线观看网站 | 精彩视频一区二区三区 | 国产日韩欧美一区二区 | 国产在线a | 亚洲久草| 久久亚洲国产精品 | 国产资源网 | 成人深夜福利在线观看 | 色男人的天堂 | 亚洲综合二区 | 99精品网站 | 久久精品成人热国产成 | 另类专区亚洲 | www.蜜桃av | h免费观看 | 久久99国产精一区二区三区 | 在线一区视频 | 午夜一级黄色片 | 亚洲精品视频一区 |