MyLocation button

Hi Community.

Is there a MyLocation button available to show the users location with a blue dot on the map?
(like in Google Maps)

I searched everything, maybe i miss the right search term?

Thanks for your help!!!

@cloudatlas

Great question! This post suggests that you can use the browser’s geolocation API to get a users location. However, we currently do not have a “MyLocation” feature in our API.

-Sam

Hi Sam. How are you doing?

Yes, we are already using the geolocation API and it works perfectly.
Here is the link: HTML Geolocation API
And here is the code in action: PWA-SPA-LOGIN-MAINSCREEN-MENU-Starter-Kit/CesiumMap.tsx at main · worldpeaceenginelabs/PWA-SPA-LOGIN-MAINSCREEN-MENU-Starter-Kit · GitHub

For now, fetching the location and moving the camera, runs on start, or on tapping the home button.
We will change the home button symbol to a location symbol and remove the “move camera on start to users location”. Voila, that’s it.

But I thought more about a Cesium myLocation button class, that I maybe miss in the documentation?
Kind of a ready-to-use “Google Maps location button” with interchangeable style.

And if not, that would be a great feature request, actually wondering, why this is missing?
There should be a location button integrated in Cesium, like duh :joy:

Thanks for your time.
Best regards

Bo

1 Like