HTML5地理位置与Google地图地理位置API [英] HTML5 geolocation vs Google Maps Geolocation api

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

问题描述

我为什么会选择使用有限访问 Google通过免费和(显然)无限制地图 navigator.geolocation 功能的HTML5?



据我可以告诉唯一的优点Google版本增加了对IE8等浏览器的支持。我在这里错过了重要的东西吗?或者差别不大?




在进一步调查中,我们注意到Chrome实际上会调用Google API来获取信息(从6年前的这个答案备份)。所以这引出了问题,它是否仍然有限? Google地图定位API是一个HTTP端点,可接受用户提供的JSON数据关于附近的Wifi网络和手机信号塔,并估计用户的位置。

HTML5 navigator.geolocation 对象提供一个浏览器API,它执行一些操作集,然后生成用户位置的估计。从 W3C地理定位规范


API本身不知道底层的位置信息来源。常见的位置信息来源包括全球定位系统(GPS)和根据网络信号(如IP地址,RFID,WiFi和蓝牙MAC地址,GSM / CDMA小区ID以及用户输入)推断的位置。

navigator.geolocation 函数可以利用浏览器应用程序可用的任何信息,包括任何信息从设备的GPS硬件中,如果有的话。当然,它也可以使用任何可以访问的第三方Web API(可能包括Google地图地理定位API)。没有必须或必须使用的具体要求的方法或输入;浏览器可以做任何事情来进行位置估算。它可能会比Google的做法做得更好或更差,具体取决于他们的特定实现方式,或者浏览器可能(如您所建议的那样)实际上直接使用Google的API。



总之,谷歌的API是一种方式来问,基于这个单元和Wifi信息,告诉我我在哪里。 HTML5 API是一种告诉浏览器的方式:您可以访问互联网和我设备上的所有物理输入;以某种方式找出我的位置。



我不惊讶地发现,如果没有GPS,浏览器可能会将其地理位置工作外包给Google等第三方服务。浏览器厂商通常对制作浏览器感兴趣,而不是写一个强大的服务来解决将cell / wifi数据转换成位置信息的难题。此外,它需要大量有关各个塔和Wifi SSID位置的地理空间数据。它会让浏览器在本地保存所有信息,任何企图远程托管信息的尝试都将在功能上成为Google已知的良好服务的竞争对手。


I'm a bit confused as to why I would choose to use the limited access Google Maps Geolocation API over the free and (apparently) unlimited navigator.geolocation feature of HTML5?

As far as I can tell the only advantage of the Google version is it's increased support for browsers such as IE8. Am I missing something significant here? Or is there little difference?


On further investigation we noticed that Chrome actually makes a call to the Google api to get the information (backed up by this answer from 6 years ago). So this begs the question, is it still limited? If so by how much in what period?

解决方案

The Google Maps Geolocation API is an HTTP endpoint that accepts user-supplied JSON data about nearby Wifi networks and cell towers and produces an estimate of the user's location.

The HTML5 navigator.geolocation object supplies a browser API that does some set of operations and then produces an estimate of the user's location. From the W3C geolocation spec:

The API itself is agnostic of the underlying location information sources. Common sources of location information include Global Positioning System (GPS) and location inferred from network signals such as IP address, RFID, WiFi and Bluetooth MAC addresses, and GSM/CDMA cell IDs, as well as user input.

The navigator.geolocation function may make use of any information available to the browser application, including any information from the device's GPS hardware, if it has any. Of course, it may also make use of any third-party Web APIs (including, possibly, the Google Maps Geolocation API) that can be reached. There is no specified required approach or inputs that must or must be used; the browser can do anything in its power to make a location estimate. It may do a better or worse job than Google's approach, depending on their particular implementations, or the browser may (as you suggest) actually directly use Google's API.

In short, Google's API is a way to ask, "Based on this cell and Wifi info, tell me where I am." The HTML5 API is a way to tell the browser, "You have access to the Internet and all the physical inputs available to my device; find out where I am, somehow."

I'm not surprised to learn that, if no GPS is present, the browser might outsource its geolocation work to a third-party service like Google. Browser vendors are generally interested in making browsers, not writing a robust service to solve the hard problem of transforming cell/Wifi data into location information. Furthermore, it requires a tremendous amount of geospatial data about the locations of various towers and Wifi SSIDs. It would bloat the browser to hold all the information locally, and any attempt for thevendor to host the information remotely would functionally be setting up a competitor to Google's already known-good service.

这篇关于HTML5地理位置与Google地图地理位置API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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