【问题标题】:navigator.geolocation.watchPosition returns NaN in speednavigator.geolocation.watchPosition 以速度返回 NaN
【发布时间】:2017-08-09 06:41:33
【问题描述】:

我在从 iOS 上 phonegap/cordova 中的 GPS 获取速度时遇到问题。无论我是开着车还是站着不动,它都会返回 NaN。

    function speed_start() {
        speed_timer_id = navigator.geolocation.watchPosition(speed_update_data,
                                                  speed_update_error,
                                                  { enableHighAccuracy: true });
}

var speed_update_data = function(position) {
        $("#speed-debug").html('Latitude: '          + position.coords.latitude          + '\n' +
              'Longitude: '         + position.coords.longitude         + '\n' +
              'Altitude: '          + position.coords.altitude          + '\n' +
              'Accuracy: '          + position.coords.accuracy          + '\n' +
              'Altitude Accuracy: ' + position.coords.altitudeAccuracy  + '\n' +
              'Heading: '           + position.coords.heading           + '\n' +
              'Speed: '             + position.coords.speed             + '\n' +
              'Timestamp: '         + position.timestamp                + '\n');
};

var speed_update_error = function(error) {
        $("#speed-debug").html(error.message);
}

【问题讨论】:

    标签: javascript ios cordova geolocation gps


    【解决方案1】:

    这是一个硬件“问题”。 GPS好像信号不够。

    【讨论】:

      猜你喜欢
      • 2017-05-15
      • 1970-01-01
      • 2017-03-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-08-12
      • 2019-02-20
      • 2020-12-24
      相关资源
      最近更新 更多