javascript - 在“地理位置”中设置时,enableHighAccuracy 是否应该有所作为?
问题描述
这是我的代码:
async getGridPointApiUrl() {
const position = await this.getPosition();
let latitude = position.coords.latitude;
let longitude = position.coords.longitude;
console.log([latitude, longitude, position.coords.accuracy]);
}
getPosition() {
return new Promise((resolve, reject) => {
navigator.geolocation.getCurrentPosition(
resolve,
reject,
{
maximumAge: 0,
timeout: Infinity,
enableHighAccuracy: true
});
});
}
当我运行这个时,我得到了 5 米的精度。没有办法是对的!返回的坐标相距 10 英里。虽然,无论enableHighAccuracy
是真还是假,我都会得到相同的结果。假设会发生这种情况吗?我在基于 Chromium 的Brave Browser上对此进行了测试。
我决定在 Firefox 上检查相同的代码,等等,返回的坐标要好得多,而且准确度读数似乎正确。但是,布尔值enableHighAccuracy
同样对 Firefox 中显示的准确性没有影响。
我在这里错过了什么吗?有没有办法让 Brave 的准确性至少和 Firefox 一样好?
解决方案
推荐阅读
- javascript - 删除复制对象内的对象的键也会删除现有对象
- java - 为什么我得到一个数组越界异常/没有密码的控制台输出?
- php - 在 Codeigniter 项目中使用 coinbase/coinbase php 库时出现 Guzzlehttp 错误
- r - 控制R中ggplot2中多个geom_line的颜色
- c# - 在 Unity 中将游戏内数据导出到 csv
- c# - Xamarin Android 模拟器失败。视觉工作室 2019
- python-3.x - 与不同的日期字段相比,如何选择所有最近的日期?
- sql - PostgresSQL:使用 FILTER 函数根据时间间隔过滤行
- android - 如何在 Android 上获取从 Cloud Functions 返回的数据
- python - ModuleNotFoundError:没有名为“graphene_django”的模块