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

标签 javascript android iphone web-applications asp.net-web-api

我正在为移动设备构建一个基于网络的注册系统。获得最准确的 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/

相关文章:

ios - 加载UIKit View Controller 和.xib作为Cocos2D场景

javascript - 在Select2中向Ajax请求传递参数

javascript - 基于 URL 的不同 CSS

javascript - 为什么 jQuery keyup 重复触发?

android - 如何将android上的三点按钮更改为其他按钮

android - select-multiple-images-from-android,如何获取Uris?

iphone - 如何从 UITableView 中删除部分 (iPhone/iPad)

iphone - UIWebView 的内存问题

javascript - 在 javascript 中根据 HTML 元素值构建 JSON 对象

c# - 如何在 Xamarin 中使用数据库项填充 ListView?