gpt4 book ai didi

javascript - 移动设备最准确的 GPS 位置

转载 作者:塔克拉玛干 更新时间:2023-11-02 23:17:35 26 4
gpt4 key购买 nike

我正在为移动设备构建一个基于网络的注册系统。获得最准确的 gps 位置(纬度/经度)非常重要。HTML5 导航器不是很准确,甚至没有像我看到的那样使用 GPS 作为 var。Google gears 好一点,但还是有超过一公里的偏差,或者有获取最近道路坐标的习惯。

有人可以告诉我如何使用 JavaScript 等获取移动设备最准确的 gps 位置吗?

最佳答案

无法强制 API 使用特定的定位方法。它们比“硬件”控制高一个级别。据我所知,他们都只是试图获得最精确/最新的数据,但不能保证他们会使用什么。您可以将 enableHighAccuracy 选项与 Geolocation API 一起使用,但这并不明确意味着它将使用 GPS。文档建议它将首先尝试。

来自文档:

The enableHighAccuracy attribute provides a hint that the application would like to receive the best possible results. This may result in slower response times or increased power consumption. The user might also deny this capability, or the device might not be able to provide more accurate results than if the flag wasn't specified. The intended purpose of this attribute is to allow applications to inform the implementation that they do not require high accuracy geolocation fixes and, therefore, the implementation can avoid using geolocation providers that consume a significant amount of power (e.g. GPS). This is especially useful for applications running on battery-powered devices, such as mobile phones.

http://dev.w3.org/geo/api/spec-source.html

P.S 避免使用 Google Gears,因为它处于 EOL 状态。

关于javascript - 移动设备最准确的 GPS 位置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12491657/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com