Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ionic-framework/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Leaflet 实时地理定位_Leaflet_Ionic Framework - Fatal编程技术网

Leaflet 实时地理定位

Leaflet 实时地理定位,leaflet,ionic-framework,Leaflet,Ionic Framework,我想用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.l

我想用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); 
  });
};

请说明哪些文档记录了执行此操作的
locate()
watch
选项。

请澄清您想问什么。我的地图上有一个标记,表示当前位置,我正试图让它每2秒钟移动一次,以跟踪用户的位置