Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update geospatial.md #2492

Merged
merged 2 commits into from
Aug 7, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions docs/data-types/geospatial.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,28 +19,28 @@ See the [complete list of geospatial index commands](https://redis.io/commands/?

## Examples

Suppose you're building a mobile app that lets you find all of the electric car charging stations closest to your current location.
Suppose you're building a mobile app that lets you find all of the bike rental stations closest to your current location.

Add several locations to a geospatial index:
```
> GEOADD locations:ca -122.27652 37.805186 station:1
{{< clients-example geo_tutorial geoadd >}}
> GEOADD bikes:rentable -122.27652 37.805186 station:1
(integer) 1
> GEOADD locations:ca -122.2674626 37.8062344 station:2
> GEOADD bikes:rentable -122.2674626 37.8062344 station:2
(integer) 1
> GEOADD locations:ca -122.2469854 37.8104049 station:3
> GEOADD bikes:rentable -122.2469854 37.8104049 station:3
(integer) 1
```
{{< /clients-example >}}

Find all locations within a 5 kilometer radius of a given location, and return the distance to each location:
```
> GEOSEARCH locations:ca FROMLONLAT -122.2612767 37.7936847 BYRADIUS 5 km WITHDIST
{{< clients-example geo_tutorial geosearch >}}
> GEOSEARCH bikes:rentable FROMLONLAT -122.2612767 37.7936847 BYRADIUS 5 km WITHDIST
1) 1) "station:1"
2) "1.8523"
2) 1) "station:2"
2) "1.4979"
3) 1) "station:3"
2) "2.2441"
```
{{< /clients-example >}}

## Learn more

Expand Down
Loading