georadiusbymember.3valkey - Man Page

Queries a geospatial index for members within a distance from a member, optionally stores the result.

Synopsis

GEORADIUSBYMEMBER key member radius <M | KM | FT | MI> [WITHCOORD] [WITHDIST] [WITHHASH] [COUNT count [ANY]] [ASC | DESC] [STORE key | STOREDIST key]

Description

This command is exactly like GEORADIUS with the sole difference that instead of taking, as the center of the area to query, a longitude and latitude value, it takes the name of a member already existing inside the geospatial index represented by the sorted set.

The position of the specified member is used as the center of the query.

Please check the example below and the GEORADIUS documentation for more information about the command and its options.

Note that GEORADIUSBYMEMBER_RO was added to provide a read-only command that can be used in replicas. See the GEORADIUS page for more information.

Reply

One of the following:

Complexity

O(N+log(M)) where N is the number of elements inside the bounding box of the circular area delimited by center and radius and M is the number of items inside the index.

Acl Categories

@geo @slow @write

History

Notes

This command is deprecated (since 6.2.0) and replaced by GEOSEARCH and GEOSEARCHSTORE with the BYRADIUS and FROMMEMBER arguments.

Examples

127.0.0.1:6379> GEOADD Sicily 13.583333 37.316667 "Agrigento"
(integer) 1
127.0.0.1:6379> GEOADD Sicily 13.361389 38.115556 "Palermo" 15.087269 37.502669 "Catania"
(integer) 2
127.0.0.1:6379> GEORADIUSBYMEMBER Sicily Agrigento 100 km
1) "Agrigento"
2) "Palermo"

See Also

geoadd(3valkey), geodist(3valkey), geohash(3valkey), geopos(3valkey), geosearch(3valkey), geosearchstore(3valkey)

Info

2024-09-23 8.0.0 Valkey Command Manual