# Location (/docs/sims/conditions/location)



<DemoTabs ids="[&#x22;location&#x22;]" />

`device.location` sets the fix the app gets from the platform's location service, so plain `expo-location` or `CLLocationManager` code sees it. A route plays fixes at a speed, which is how a geofence or a run tracker gets exercised.

```ts
await device.location.set({ lat: 37.3349, lon: -122.009 });
await device.location.route(
  [{ lat: 37.3398, lon: -122.009 }, { lat: 37.3349, lon: -122.009 }, { lat: 37.33, lon: -122.009 }],
  { speedMps: 40, intervalS: 1 },
);
await device.location.route({ gpx: "fixtures/commute.gpx" });
await device.location.scenario("city-run"); // "city-run" | "city-bike" | "freeway"
await device.location.clear();
```

| Call                                                         | Does                                                                                                                       |
| ------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------- |
| `set({ lat, lon, altM? })`                                   | a point                                                                                                                    |
| `route(points \| { gpx }, { speedMps?, intervalS?, loop? })` | waypoints, or a GPX file (relative to the working directory), played at a speed                                            |
| `scenario(name)`                                             | one of the bundled routes                                                                                                  |
| `clear()`                                                    | iOS clears the simulated location. Android stops the ticker and keeps the last fix (the emulator console cannot unset one) |

## How a route plays [#how-a-route-plays]

On iOS `simctl` plays a route once. On Android a ticker owned by the lease sends a fix every interval until the next location call, and stops when the lease is released.

## In a suite [#in-a-suite]

```ts title="warden.config.ts"
conditions: { location: "city-run" },
```

`location` takes `{ lat, lon, altM? }` or a scenario name. Every spec starts from it.

## By hand [#by-hand]

```bash
warden ui location set 37.3349,-122.009
warden ui location route 37.3398,-122.009 37.3349,-122.009 --speed 20
warden ui location gpx ./commute.gpx
warden ui location scenario city-run
warden ui location clear
```

See [warden ui](/docs/sims/ui) for every flag.

## Limitations [#limitations]

* `route` with `loop` is unsupported on iOS (`E_UNSUPPORTED`): `simctl` has no loop.
* Android keeps the last GPS fix after `clear()` and after release: the emulator cannot unset one.
