Reputation: 23
How can I solve that the camera always follow the user's Geolocation? I tried this, but it doesn't work:
trackuserlocationstart.trigger();
Sorry, but I'm really newbie in this.
Upvotes: 0
Views: 70
Reputation: 126235
It should be as easy as this:
if (navigator.geolocation) {
navigator.geolocation.watchPosition(({ latitude, longitude }) => {
map.panTo([longitude, latitude]);
});
};
Upvotes: 1