简体   繁体   中英

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. In other words the direction which the user is facing in mapbox gl js and also if he chenges his direction. 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.

I am looking for a approach involving android webview and js for my solution. 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. Mapbox GL JS's GeolocateControl is a wrapper around the browser's Geolocation API. This API does not have support for providing a user's bearing. 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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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