GEORADIUS
Deprecated: use GEOSEARCH and GEOSEARCHSTORE instead.
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
- Arity
- -6 (at least 6 words, counting the command name)
- Flags
- write
- Keys
- first 1, last 1, step 1
- HotKV Cloud
- All plans
- On-Premise
- no license needed
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 replaces the STORE
options.
Options
Section titled “Options”| Option | Effect |
|---|---|
WITHCOORD, WITHDIST, WITHHASH |
Add coordinates, distance (in the radius unit) or raw score to each result, as for GEOSEARCH. |
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 when you only read, for example on
a replica.
Return value
Section titled “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
Section titled “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) 4127.0.0.1:6379> GEORADIUS cities 4 51 120 mi WITHDIST1) 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) 2Compatibility
Section titled “Compatibility”Same as Redis 7 and Valkey 8, where it is also deprecated. HotKV always sorts results by distance; see GEOSEARCH for the ordering notes.
See also
Section titled “See also”Was this page helpful?
Thanks for the feedback.