Tracking user location with Mapbox GL JS
This repo contains a simple test of the support for the Geolocation API in Mapbox GL JS v1.13.1. You can view the demo at flother.github.io/mapbox-user-location. Tap or click the little "target" icon in the top-right corner and then bike/scoot/drive around your environment. The map will follow your location as you go. To see how it's done, read the documentation on the Mapbox GL JS GeolocateControl
.
Either Mapbox GL JS v1.13.1 or MapLibre v1.14.0 is recommended. Version 2.0+ of Mapbox GL JS brings higher costs and a less open licence.