简体   繁体   English

在 Mapbox gl js 中查找用户的方向/方位及其变化

[英]Finding the direction/bearing of the user and changes in it in Mapbox gl js

I am trying to find the bearing of the user in mapbox gl js and detect any change in it.我试图在 mapbox gl js 中找到用户的方位并检测其中的任何变化。 In other words the direction which the user is facing in mapbox gl js and also if he chenges his direction.换句话说,用户在 mapbox gl js 中面对的方向以及他是否改变了他的方向。 But I couldn't find much on this topic apart from this with some of its links not working and other being cordova specific solutions.但除此之外,我在这个主题上找不到太多东西,它的一些链接不起作用,还有一些是 cordova 特定的解决方案。

I am looking for a approach involving android webview and js for my solution.我正在为我的解决方案寻找一种涉及 android webview 和 js 的方法。 There are very few examples that I have been able to find regarding this.我能找到的例子很少。

Can anyone help me out here with anything on this please?任何人都可以帮我解决这个问题吗?

Edit编辑

I am trying to find user's bearing, without using markers on the screen.我试图找到用户的方位,而不是在屏幕上使用标记。

The Geolocation API is the standard web API for enabling users to provide their location to web applications. 地理定位 API是标准 web API 使用户能够向 Z2567A5EC9705EB7AC2DZ98403 应用程序提供他们的位置。 Mapbox GL JS's GeolocateControl is a wrapper around the browser's Geolocation API. Mapbox GL JS 的GeolocateControl是浏览器地理定位 API 的包装器。 This API does not have support for providing a user's bearing.此 API 不支持提供用户方位。 Since there is no standard API across browsers for providing user bearing information, Mapbox GL JS does not natively expose a way to retrieve it.由于跨浏览器没有标准的 API 来提供用户方位信息,因此 Mapbox GL JS 本身并没有公开检索它的方法。

If you are building for mobile, native SDKs such as the Mapbox Maps SDK for Android provide far more granularity for accessing current user location and bearing than web APIs.如果您正在为移动设备构建,本机 SDK(例如用于 Android 的 Mapbox Maps SDK)为访问当前用户位置和方位提供了比 web API 更多的粒度。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM