Skip to content

Instantly share code, notes, and snippets.

@grandmanitou
Created January 16, 2020 14:33
Show Gist options
  • Save grandmanitou/1473b8abec32bbb7c0c54f48d595ef83 to your computer and use it in GitHub Desktop.
Save grandmanitou/1473b8abec32bbb7c0c54f48d595ef83 to your computer and use it in GitHub Desktop.
Locate user with mapbox
let geoTracker = new mapboxgl.GeolocateControl({
positionOptions: {
enableHighAccuracy: true
},
trackUserLocation: false,
showUserLocation: true,
});
geoTracker.on('geolocate', function (e) {
getGeoJson(e.coords.longitude, e.coords.latitude, 5);
});
map.addControl(geoTracker);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment