Html5地理位置中的高精度 [英] Very High Accuracy in Html5 Geolocation

查看:60
本文介绍了Html5地理位置中的高精度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试制作增强现实游戏,在该游戏中,用户可以拍摄仅使用手机使用网络应用程序的其他人.问题是,我需要某种方法来找出用户所在的位置.我已经想到了几种方法来做到这一点,如下所示:

I'm trying to make an augmented reality game, in which the user can shoot other people who are using the web app with only their phone. The problem is, I need some way to figure out where a user is. I have thought of several ways to do this, as shown below:

  • HTML5地理位置
  • 使用陀螺仪和加速度计
  • 以某种方式使用XMLHttpRequest来"ping"服务器并根据响应时间计算位置
  • 最后2个的组合

到目前为止,看来我将使用地理位置,但问题是它不是很准确.我需要精确到大约一英尺的高度,并且很快就会更新.我想在没有本机iOS或Android的情况下执行此操作.如果需要的话,这可能是本地事物,例如,您必须彼此相距一定距离,才能连接到接入点.预先感谢.

So far, it's looking like I'm going to use geolocation, but the problem is it's not very accurate. I need accuracy to about a foot that updates pretty quickly. I want to do this without native iOS or Android. If needed, it can be a local thing where you have to be within a certain distance of each other, for example to connect to an access point. Thanks in advance.

推荐答案

HTML5地理位置API具有 enableHighAccuracy 选项,除了 watchPosition 方法之外,该选项还可以打开当设备更改位置时,它将更新.

The HTML5 Geolocation API has an enableHighAccuracy option that can be turned on in addition to a watchPosition method that will update when the device changes location.

我在工作中使用了 enableHighAccuracy 选项,根据我的经验,它通常在几英尺内就非常准确.将它与 watchPosition 一起使用可能会帮助您避免错误的坐标,因为它会按设定的时间间隔进行更新.

I've used the enableHighAccuracy option at work and in my experience it's usually pretty accurate within a few feet. Using it along with watchPosition would likely help you avoid erroneous coordinates since it updates on a set interval.

有关更多详细信息,请参见此处: https://developer.mozilla.org/en-US/docs/Web/API/Geolocation

See here for more details: https://developer.mozilla.org/en-US/docs/Web/API/Geolocation

我真的不能说您建议的其他方法,但是我希望这会有所帮助.

I can't really speak on the other methods you suggested, but I hope this was helpful.

这篇关于Html5地理位置中的高精度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆