---
updatedAt: 2026-06-02T15:59:48.000Z
agentTools:
  projectIndex: https://developers.unitmap.com/llms.txt
---

# Locator

The Locator instance provides methods for displaying and positioning the locator icon. An instance is created via the [`UnitMap.locator()`](https://developers.unitmap.com/docs/js-api-unitmap#unitmaplocator) method.

<Embed title="Locator Example" typeOfEmbed="iframe" url="https://codesandbox.io/embed/locator-rzkvv?view=preview&module=%2Findex.html&hidenavigation=1" height="500px" width="100%" />

<Image title="locator-icon.svg" alt={2000} width="100%" border={true} src="https://files.readme.io/ce78126-locator-icon.svg">
  An image of the locator icon.
</Image>

> 📘 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.

```javascript Usage Example
map.on("ready", function() {
	// Create a Locator instance via `map.locator()`, which can only be called once the map has loaded.

  var locator = map.locator();
});
```

## Locator.translate(\[point])

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

#### Arguments

<Table align={["left","left","left","left","left"]}>
  <thead>
    <tr>
      <th>
        Argument
      </th>

      <th>
        Required
      </th>

      <th>
        Type
      </th>

      <th>
        Default Value
      </th>

      <th>
        Description
      </th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>
        point
      </td>

      <td>
        No
      </td>

      <td>
        Array
      </td>

      <td>
        undefined
      </td>

      <td>
        An array representing an x and y coordinate pair of a position in map space.\
        Example: `[1, 5]`.
      </td>
    </tr>
  </tbody>
</Table>

#### Returns

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

## Locator.show()

Display the locator icon. This method is chainable.

## Locator.hide()

Hide the locator icon. This method is chainable.