Skip to content

Ask the HotKV docs

Answers come only from these docs and can be wrong; check the linked pages before you rely on them.

GEORADIUS

Last updated

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.

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.

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.

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

Same as Redis 7 and Valkey 8, where it is also deprecated. HotKV always sorts results by distance; see GEOSEARCH for the ordering notes.

GEOSEARCH, GEOSEARCHSTORE, GEORADIUS_RO, GEORADIUSBYMEMBER