georadius
GEORADIUS
Apply for Redis Developer Course
|
Redis Regular Inspection / Technical Support
|
Redis Enterprise Server
|
|---|
Query cities near a given point
Usage: georadius key longitude latitude radius km
Find members within a given radius (km) from the specified point.
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> GEORADIUS map 127 38 200 km
Result> 1) "incheon"
2) "seoul"
3) "daejeon"
Command> GEORADIUS map 127 38 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> GEORADIUS map 127 38 200 km withdist asc
Result>
1) 1) "seoul"
2) "48.2515"
2) 1) "incheon"
2) "65.8043"
3) 1) "daejeon"
2) "186.6152"
Syntax
GEORADIUS key longitude latitude 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)).
- 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> GEORADIUS map 127 38 200 km
Result> 1) "incheon"
2) "seoul"
3) "daejeon"
Command> GEORADIUS map 127 38 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> GEORADIUS map 127 38 200 km withdist asc
Result>
1) 1) "seoul"
2) "48.2515"
2) 1) "incheon"
2) "65.8043"
3) 1) "daejeon"
2) "186.6152"
Syntax
GEORADIUS key longitude latitude 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)).
- ASC: nearest first
- DESC: farthest first
Store result option
- STORE key: cannot be used together with WITH options.
Example
Command> GEORADIUS map 127 38 200 km
Result> 1) "incheon"
2) "seoul"
3) "daejeon"
Command> GEORADIUS map 127 38 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> GEORADIUS map 127 38 200 km withdist asc
Result>
1) 1) "seoul"
2) "48.2515"
2) 1) "incheon"
2) "65.8043"
3) 1) "daejeon"
2) "186.6152"
Syntax
GEORADIUS key longitude latitude 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)).
Example
| Command> | GEORADIUS map 127 38 200 km |
| Result> | 1) "incheon" 2) "seoul" 3) "daejeon" |
| Command> | GEORADIUS map 127 38 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> | GEORADIUS map 127 38 200 km withdist asc |
| Result> |
1) 1) "seoul" 2) "48.2515" 2) 1) "incheon" 2) "65.8043" 3) 1) "daejeon" 2) "186.6152" |
[WITHCOORD] [WITHDIST] [WITHHASH] [COUNT count]
[ASC|DESC] [STORE key] [STOREDIST key]
| << GEORADIUSBYMEMBER | GEORADIUS | GEOHASH >> |
|---|
Email
답글이 올라오면 이메일로 알려드리겠습니다.
