简体   繁体   English

在传单中获取高度和航向

[英]Obtaining altitude and heading in leaflet

Im using leaflet for my mobile app.我在我的移动应用程序中使用传单。 I can gain access to e.latlng and e.accuracy with no problem but e.speed and e.heading just return UNDEFINED我可以毫无问题地访问 e.latlng 和 e.accuracy,但 e.speed 和 e.heading 只是返回 UNDEFINED

$scope.makeFit = function() {
        leafletData.getMap().then(function(map) {
        map.locate({setView: true, maxZoom: 16, watch:true,enableHighAccuracy: true});
        map.on('locationfound', onLocationFound);
         punto = L.circleMarker([35.80048816577000, 9.634765625], {color: '#136AEC', fillColor: '#2A93EE',fillOpacity: 0.7, weight: 2,opacity: 0.9, radius: 4}).addTo(map);
         function onLocationFound(e) {
       var radius = e.accuracy / 2;
       punto.setLatLng(e.latlng);

      alert(e.altitude);


  }

        });
      };

This is an implementation detail of your specific device - some phones or computers support heading and speed, some don't.这是您的特定设备的实现细节 - 有些手机或计算机支持航向和速度,有些则不支持。 It's not something that Leaflet can guarantee, so Leaflet just passes what your device offers on to you in the event.这不是 Leaflet 可以保证的,因此 Leaflet 只是在活动中将您的设备提供的内容传递给您。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM