The Locator object provides methods for displaying and positioning the locator icon. An instance is created via the locator() method on a Unit Map instance.

You can also view a code example on codesandbox.io.


An image of the locator icon.


This icon is used to highlight a single position on the map, most likely that of a user's geolocation, but can have other use cases and is not directly coupled to geo positioning data.

map.on("ready", function() {
	// Create a Locator instance via `map.locator()`, which can only be called once a unit map has loaded.
  var locator = map.locator();  


Moves the locator icon to the given position if provided. Otherwise returns the current position value.


ArgumentRequiredTypeDefault ValueDescription
pointNoArrayundefinedAn array representing an x and y coordinate pair of a position in map space.
Example: [1, 5].


Either an [x, y] coordinates Array of the current position or the object chain.


Display the locator icon. This method is chainable.


Hide the locator icon. This method is chainable.

What’s Next