【问题标题】:Real-Time geolocation ionic实时地理定位离子
【发布时间】:2014-08-16 04:27:27
【问题描述】:

我想用 ionic 构建移动应用程序,首先对用户进行地理定位,我想每 2 秒更新一次他的位置,这是地理定位的代码

$scope.makeFit = function() {
  leafletData.getMap().then(function(map) {
    map.locate({setView: true, maxZoom: 16});
    var marker;
    function onLocationFound(e) {
      marker= new L.Marker(e.latlng);
      marker.addTo(map)
            .bindPopup("" + e.latlng + " ");
    }
    map.on('locationfound', onLocationFound); 
  });
};

【问题讨论】:

  • 请说明你想问什么。
  • 我的地图上有一个标记代表当前位置,我试图让它每 2 秒移动一次以跟随用户的位置

标签: leaflet ionic-framework


【解决方案1】:

read the Leaflet reference documentation,它记录了locate()watch 选项,它将执行此操作。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-12-23
    • 1970-01-01
    • 1970-01-01
    • 2017-08-17
    • 2018-11-20
    • 2015-12-19
    • 1970-01-01
    • 2018-05-03
    相关资源
    最近更新 更多