HTML5的GeoLocation究竟是如何工作的? [英] How, exactly does HTML5's GeoLocation work?

查看:87
本文介绍了HTML5的GeoLocation究竟是如何工作的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道浏览器会分享我的IP地址和附近无线网络的详细信息来确定我的位置,但是它知道附近的无线网络有哪些信息? b
$ b

例如,我住的地方没有公共无线网络,从我家可以看到大约5个私人网络,但我的位置在20米内确定。由于附近没有开放网络,Google如何确定我的位置?我能想到的唯一方法就是Google在为街景图绘制街道时映射了所有无线网络的位置。



我在网上搜索过,但所有的找不到任何具体的细节。

解决方案

由Firefox发送给Google的数据适用于所有可见的接入点,公共或私人。对于检测到的每个访问点,它会将以下数据发送到 https://www.google.com/loc/json

 mac_address:01-23-45-67-89-ab,
signal_strength:8,
age:0 ,
SSID:MyAccessPoint

其中


  • mac_address 是WiFi节点的MAC地址。

  • signal_strength 是以dBm为单位测量的当前信号强度。
  • age 是检测到WiFi节点后的毫秒数。 / code> 是名称或 ESSID


用于对您的请求进行地理编码的地理参考WiFi数据为

请注意,但是,这就是HTML5地理位置API如何使用Google的地理定位服务在Firefox上实施的。 这是一个实现,而不是规范。如果您的设备具有内置GPS,则可能需要您的HTML5实现直接查询GPS,而不是使用地理定位服务。



即使firefox在Windows和Linux上也以不同的方式实现此功能。使用Windows上的当前Firefox,将所有可见WiFi节点的详细信息发送给Google。使用Linux上的当前Firefox,由于仅发送当前连接的WiFi节点的详细信息依赖 libiw 作为访问点数据。



另一位回复者指出,Safari使用 Skyhook Wireless 的服务与Google的定位服务完全相同。


I know the browser shares my IP address and details of nearby wireless networks to determine my location, but what sort of info does it know about nearby wifi networks?

For example, where I live are no public wireless networks, and from my home I can see about 5 private networks, yet my location is determined within 20 meters. With there being no open networks nearby, how does Google determine my location? The only way I can think of is that Google mapped the locations of all wireless networks when they mapped streets for Street View.

I've searched about online, but all I can't find any specific details.

解决方案

The data sent by Firefox to Google is for all visible access points, public or private. For each access point detected, it sends the following data to https://www.google.com/loc/json:

  "mac_address": "01-23-45-67-89-ab",
  "signal_strength": 8,
  "age": 0,
  "SSID": "MyAccessPoint"

where

  • mac_address is the mac address of the WiFi node.
  • signal_strength is current signal strength measured in dBm.
  • age is the number of milliseconds since the WiFi node was detected.
  • SSID is the name or ESSID of the WiFi node.

The georeferenced WiFi data used to geocode your request was collected when Google was driving around taking pictures for StreetView.

It is important to note that, however, that this is how the HTML5 geolocation API is implmeneted on Firefox using Google's Geolocation Services. This is an implementation, not a specification. If your device has a built-in GPS, it is probably desirable that your HTML5 implementation queries the GPS directly, rather than using a geolocation service.

Even firefox implements this feature differently on Windows and Linux. Using a current Firefox on Windows, details of all visible WiFi nodes are sent to Google. Using a current Firefox on Linux, only details of the currently connected WiFi node is sent, due to the reliance on libiw for access point data.

As another answerer noted, Safari uses Skyhook Wireless's service which does much the same thing as Google's Location Services.

这篇关于HTML5的GeoLocation究竟是如何工作的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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