GEORADIUSBYMEMBER

Apply for Redis Developer Course Redis Regular Inspection / Technical Support Redis Enterprise Server

Query cities near a given member

Usage: georadiusbymember key member radius km
Find members within a given radius (km) from the specified member.

Distance unit
  • m: meter
  • km: kilometer
  • ft: feet, 0.3048 meter
  • mi: mile, 1.6093 kilometer

WITH option: can be combined
  • WITHCOORD: get coordinates
  • WITHDIST: get distance
  • WITHHASH: get hash value

COUNT count option
  • Select how many members to return

Sort: ASC/DESC option
  • ASC: nearest first
  • DESC: farthest first

Store result option
  • STORE key: cannot be used together with WITH options.

Example

Command>GEORADIUSBYMEMBER map seoul 200 km
Result>1) "incheon"
2) "seoul"
3) "daejeon"
Command>GEORADIUSBYMEMBER map seoul 200 km withcoord
Result> 1) 1) "incheon"
    2) 1) "126.70520693063735962"
        2) "37.45625514418296831"
2) 1) "seoul"
    2) 1) "126.97797149419784546"
        2) "37.56653579238348328"
3) 1) "daejeon"
    2) 1) "127.38454610109329224"
        2) "36.3504120662288841
Command>GEORADIUSBYMEMBER map seoul 200 km withdist asc
Result> 1) 1) "seoul"
    2) "0.0000"
2) 1) "incheon"
    2) "27.0112"
3) 1) "daejeon"
    2) "140.0080"

Syntax

GEORADIUSBYMEMBER key member radius m|km|ft|mi
[WITHCOORD] [WITHDIST] [WITHHASH] [COUNT count]
[ASC|DESC] [STORE key] [STOREDIST key]

  • Available since version 3.2.0.
  • Time complexity is O(N+log(M)).

<< GEODIST GEORADIUSBYMEMBER GEORADIUS >>

Email 답글이 올라오면 이메일로 알려드리겠습니다.