Locate component

Find and zoom to the user's current location using the Locate component. This component uses the browser's Geolocation API to find the user's current location. Once the location is found, the view animates to that location, and the view rotates according to the direction where the tracked device is heading towards. The component provides options that allow the developer to define the following:

  • geolocationOptions for finding a location such as maximumAge, timeout and enableHighAccuracy.
  • The ability to define a custom graphic to highlight the user's location on the map.

The Locate component will only work in secure contexts. To use it, switch your application to a secure URL, such as https://. Note that http://localhost is considered to be trustworthy, and can be used for testing.

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.