Skip to content

Commit 9a6ec4c

Browse files
committed
Update geospatial stage description for the GEOADD command and its usage.
1 parent 29e33a1 commit 9a6ec4c

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed
Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,43 @@
11
In this stage, you'll add support for responding to the `GEOADD` command.
22

33
### The `GEOADD` command
4-
The `GEOADD` command adds a location (with longitude, latitude, and name) to a key. It stores the location as a [sorted set](https://redis.io/docs/latest/develop/data-types/sorted-sets/) under the specified key. If the key doesn’t exist, a new sorted set is created under the specified name and the location is inserted to it. If the key exists, the location is inserted in the sorted set.
4+
5+
The [`GEOADD` command](https://redis.io/docs/latest/commands/geoadd/) adds a location (with longitude, latitude, and name) to a key. It stores the location as a [sorted set](https://redis.io/docs/latest/develop/data-types/sorted-sets/) under the specified key.
56

67
Example usage:
78

89
```bash
910
> GEOADD places -0.0884948 51.506479 "London"
1011
(integer) 1
1112
```
12-
The argument order of `GEOADD` argument – key, longitude, latitude, member (longitude first, then latitude).
13+
14+
The arguments `GEOADD` accepts are:
15+
16+
1. `key`: The key to store the location in.
17+
2. `longitude`: The longitude of the location.
18+
3. `latitude`: The latitude of the location.
19+
4. `member`: The name of the location.
1320

1421
It returns the count of elements added, encoded as a RESP Integer.
1522

23+
In this stage, you'll only implement the response to the `GEOADD` command. We'll get to validating arguments and storing locations in later stages.
24+
1625
### Tests
26+
1727
The tester will execute your program like this:
1828

1929
```bash
2030
$ ./your_program.sh
2131
```
2232

23-
It will then send a `GEOADD` command specifying a key, latitude, longitude, and location name.
33+
It will then send a `GEOADD` command:
2434

2535
```bash
2636
$ redis-cli GEOADD places 11.5030378 48.164271 Munich
2737
```
2838

29-
The tester will expect the response to be `:1\r\n`, which is 1(number of locations added) encoded as a RESP integer.
39+
The tester will expect the response to be `:1\r\n`, which is 1 (number of locations added) encoded as a RESP integer.
3040

3141
### Notes
32-
- In this stage, you will only implement responding the the `GEOADD` command. You don't need to store the locations yet. We'll get to storing the locations in the later stages.
42+
43+
- In this stage, you only need to implement responding to the `GEOADD` command. We'll get to validating arguments and storing locations in later stages.

0 commit comments

Comments
 (0)