# GEORADIUS

> Find members of a geospatial index within a radius of a position (legacy form of GEOSEARCH).

URL: https://docs.hotkv.com/commands/georadius/

```
GEORADIUS key longitude latitude radius <M | KM | FT | MI> [WITHCOORD] [WITHDIST] [WITHHASH] [COUNT count [ANY]] [ASC | DESC] [STORE key | STOREDIST key]
```

- Group: Geospatial
- Complexity: O(N + log M), N being the members in the area searched
- HotKV Cloud: all plans
- On-Premise: no license needed
- Deprecated: use GEOSEARCH and GEOSEARCHSTORE instead

`GEORADIUS` returns the members of the geospatial index at `key` within
`radius` of the given longitude and latitude. It is kept for older clients:
`GEOSEARCH key FROMLONLAT longitude latitude BYRADIUS radius unit` does the
same, and [GEOSEARCHSTORE](https://docs.hotkv.com/commands/geosearchstore/index.md) replaces the `STORE`
options.

## Options

| Option | Effect |
| --- | --- |
| `WITHCOORD`, `WITHDIST`, `WITHHASH` | Add coordinates, distance (in the radius unit) or raw score to each result, as for [GEOSEARCH](https://docs.hotkv.com/commands/geosearch/index.md). |
| `COUNT count [ANY]` | Return only the `count` nearest matches (`ANY` is accepted; the nearest are still returned). |
| `ASC`, `DESC` | Nearest first (the default) or farthest first. |
| `STORE key` | Store the matches, with their positions as scores, in the sorted set at `key` and return their count. |
| `STOREDIST key` | Store the matches with their distances as scores. |

`STORE` and `STOREDIST` cannot be combined with the `WITH...` options. Use
[GEORADIUS_RO](https://docs.hotkv.com/commands/georadius_ro/index.md) when you only read, for example on
a replica.

## Return value

| Case | RESP2 | RESP3 |
| --- | --- | --- |
| Without `STORE` | Array of members, or of arrays with the extra fields, as for GEOSEARCH | Same; coordinates are doubles |
| With `STORE` or `STOREDIST` | Integer: members stored | Integer |

Error replies: those of GEOSEARCH for the radius, unit, coordinates and
`COUNT`, plus
`ERR STORE option in GEORADIUS is not compatible with WITHDIST, WITHHASH and WITHCOORD options`,
`ERR syntax error`, and `WRONGTYPE`.

## Examples

```
127.0.0.1:6379> GEOADD cities -0.1276 51.5072 london 2.3522 48.8566 paris 4.3517 50.8503 brussels 4.9041 52.3676 amsterdam
(integer) 4
127.0.0.1:6379> GEORADIUS cities 4 51 120 mi WITHDIST
1) 1) "brussels"
   2) "18.4876"
2) 1) "amsterdam"
   2) "102.1481"
127.0.0.1:6379> GEORADIUS cities 4 51 120 mi STORE lowlands
(integer) 2
```

## Compatibility

Same as Redis 7 and Valkey 8, where it is also deprecated. HotKV always sorts
results by distance; see [GEOSEARCH](https://docs.hotkv.com/commands/geosearch/index.md) for the ordering
notes.

## See also

[GEOSEARCH](https://docs.hotkv.com/commands/geosearch/index.md), [GEOSEARCHSTORE](https://docs.hotkv.com/commands/geosearchstore/index.md),
[GEORADIUS_RO](https://docs.hotkv.com/commands/georadius_ro/index.md), [GEORADIUSBYMEMBER](https://docs.hotkv.com/commands/georadiusbymember/index.md)