html5 - JavaScript获取到的位置有错
伊谢尔伦
伊谢尔伦 2017-04-11 10:50:00
0
2
408
伊谢尔伦
伊谢尔伦

小伙看你根骨奇佳,潜力无限,来学PHP伐。

全部回覆 (2)
刘奇

请看 html5 关于 Geolocation API 规范的描述:

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. No guarantee is given that the API returns the device's actual location.

来源

这已经指明了这个API返回位置的源信息来自于GPS、IP、RFID、WiFi、蓝牙MAC地址、GSM/CDMA,甚至户输入。并不保证得到结果是设置所在的实际位置。因此,如果源信息设备能提供GPS信号则返回的结果就准确,如果测试模拟的设备根本获取不到GPS信息,那么只能通过其他允许的信号源了,就这里而言很可能是IP地址。精度当然差很多

    黄舟

    navigator.geolocation得到的坐标是按wgs84标准来的,高德的坐标系貌似是按gcj02标准来的,你需要转换下才能判断是否是准确的。

      最新下載
      更多>
      網站特效
      網站源碼
      網站素材
      前端模板
      關於我們 免責聲明 Sitemap
      PHP中文網:公益線上PHP培訓,幫助PHP學習者快速成長!