GEOSEARCHSTORE
GEOSEARCHSTORE destination source <FROMMEMBER member | FROMLONLAT longitude latitude> <BYRADIUS radius <M | KM | FT | MI> | BYBOX width height <M | KM | FT | MI>> [ASC | DESC] [COUNT count [ANY]] [STOREDIST]
- Available since:
- Redis Open Source 6.2.0
- Time complexity:
- O(N+log(M)) where N is the number of elements in the grid-aligned bounding box area around the shape provided as the filter and M is the number of items inside the shape
- ACL categories:
-
@write,@geo,@slow, - Compatibility:
- Redis Software and Redis Cloud compatibility
This command is similar to GEOSEARCH, but it stores the result in the provided destination.
This command replaces the now deprecated GEORADIUS and GEORADIUSBYMEMBER.
By default, it stores the results in the destination sorted set with their geospatial information.
When using the STOREDIST option, the command stores the items in a sorted set populated with their distance from the center of the circle or box, as a floating-point number, in the same unit specified for that shape.
Required arguments
destination
The key to store the results in.
source
The geospatial index key to search.
Query center points:
FROMMEMBER member
Use the position of the existing member as the center of the search. Mutually exclusive with FROMLONLAT.
FROMLONLAT longitude latitude
Use the given coordinates as the center of the search. Mutually exclusive with FROMMEMBER.
Query shape options:
BYRADIUS radius M | KM | FT | MI
Search within a circle of the given radius in the specified unit. Mutually exclusive with BYBOX.
BYBOX width height M | KM | FT | MI
Search within an axis-aligned box of the given width and height in the specified unit. Mutually exclusive with BYRADIUS.
Optional arguments
ASC | DESC
Sort the results by distance from the center: nearest first (ASC) or farthest first (DESC).
COUNT count [ANY]
Return at most count matches. With ANY, the command returns as soon as enough matches are found — faster, but the results may be unsorted.
STOREDIST
Store the distance from the center as the sorted-set score, instead of the geohash-encoded position.
Examples
Redis Software and Redis Cloud compatibility
| Redis Software |
Redis Cloud |
Notes |
|---|---|---|
| ✅ Standard |
✅ Standard |
Return information
History
- Starting with Redis version 7.0.0: Added support for uppercase unit names.