geoadd
GEOADD
Apply for Redis Developer Course
|
Redis Regular Inspection / Technical Support
|
Redis Enterprise Server
|
|---|
Add geospatial coordinates
Usage: geoadd key longitude (vertical line) latitude (horizontal line) member(city)
Longitude ranges from -180 to 180, and latitude ranges from -85.05112878 to 85.05112878.
Returns the number of members added. If the member already exists, longitude and latitude are updated.
Example
| Command> | GEOADD map 126.97796919999996 37.566535 seoul |
| Result> | (integer) 1 |
| Command> | GEOADD map 127.38454750000005 36.3504119 daejeon |
| Result> | (integer) 1 |
| Command> | GEOADD map 129.07564160000004 35.1795543 busan |
| Result> | (integer) 1 |
XX, NX, CH options
These options were added in version 6.2.
- XX: Update existing members. Do not add new members.
- NX: Add new members. Do not update existing members.
- CH: Return the number of members that were newly added or changed. Without the CH option, changed members are not counted in the return value.
Syntax
GEOADD key [NX|XX] [CH] longitude latitude member [longitude latitude member ...]
- Available since version 3.2.0.
- XX, NX, CH options were added in version 6.2.
- Time complexity is O(log(N)). N is the number of members stored in the Sorted Set.
| << GEO Introduction | GEOADD | GEOPOS >> |
|---|
Email
답글이 올라오면 이메일로 알려드리겠습니다.
