# useLocate

Finds the user's location through the services' `LocationProvider`, one
request at a time. Each request has its own `AbortController`, aborted by
a newer request, by `cancel` and on unmount; a cancelled request never
changes state or announces anything.

This is a function exported by `@mapcairn/map`, checked against version 0.2.0.

## Signature

```ts
import { useLocate } from "@mapcairn/map";
 
function useLocate(units: UnitSystem, input?: UseLocateOptions): UseLocate;
```

## Description

The outcome is announced through the app-wide announcer, and `message`
carries the same wording for the visible status.

## Parameters

- `units` (`UnitSystem`)
- `{ timeoutMs, announceErrors }?`
- `input?` (`UseLocateOptions`)

## Returns

`UseLocate`

## Remarks

Announcing and showing the same error means a screen reader may
 hear it twice if the app puts `message` in an alert `StatusMessage`;
 pass `announceErrors: false` in that case.

## See also

- [`UnitSystem`](https://docs.mapcairn.com/api/core/UnitSystem.md)
- [`UseLocateOptions`](https://docs.mapcairn.com/api/map/UseLocateOptions.md)
- [`UseLocate`](https://docs.mapcairn.com/api/map/UseLocate-interface.md)

Source: [packages/map/src/tools/locate/useLocate.ts:77](https://github.com/MapCairn/mapcairn/blob/main/packages/map/src/tools/locate/useLocate.ts#L77)
