Mapbox GL JS 轴承

2024-01-02

Is it possible in Mapbox GL JS to get the users bearing? I would like to show the direction in which the user is facing, to assist them in navigating to nearby POI. I understand that it is possible to set the bearing of the map and also get the current bearing of it, but i need the actual real life bearing of the user. Kind of the same thing as on Google Maps: enter image description here

该服务旨在作为 iOS 和 Android 上的 Ionic 应用程序运行,方位辅助是帮助他们在人口稠密的地图上定位附近 POI 的关键功能。


您可以通过获取用户的方位(如果他们的设备有这样的传感器)Coordinates对象来自Gelocation#getCurrentPosition() https://developer.mozilla.org/en-US/docs/Web/API/Geolocation/getCurrentPosition和阅读Coordinates#heading https://developer.mozilla.org/en-US/docs/Web/API/Coordinates/heading.

Mapbox GL JS 没有用于显示用户标题的内置用户界面。构建您自己的用户界面很容易。看这个例子使用了symbol-rotation财产 https://www.mapbox.com/mapbox-gl-js/example/rotating-controllable-marker/.

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Mapbox GL JS 轴承 的相关文章

随机推荐