Interface GeoCommands
- All Known Subinterfaces:
JedisCommands
- All Known Implementing Classes:
Jedis,JedisCluster,JedisPooled,JedisSentineled,JedisSharding,UnifiedJedis
-
Method Summary
Modifier and TypeMethodDescriptionlongAdds the specified geospatial item (longitude, latitude, member) to the specified key.longgeoadd(String key, Map<String, GeoCoordinate> memberCoordinateMap) Adds the specified geospatial items (in memberCoordinateMap) to the specified key.longgeoadd(String key, GeoAddParams params, Map<String, GeoCoordinate> memberCoordinateMap) Adds the specified geospatial items (in memberCoordinateMap) to the specified key.Return the distance between two members in the geospatial index represented by the sorted set.Return the distance between two members in the geospatial index represented by the sorted set.Return valid Geohash strings representing the position of the given members.Return the positions (longitude,latitude) of all the specified members.Return the members of a sorted set populated with geospatial information using GEOADD, which are within the borders of the area specified with the center location and the radius.georadius(String key, double longitude, double latitude, double radius, GeoUnit unit, GeoRadiusParam param) Return the members of a sorted set populated with geospatial information using GEOADD, which are within the borders of the area specified with the center location and the radius.georadiusByMember(String key, String member, double radius, GeoUnit unit) This command is exactly likeGEORADIUSwith the sole difference that instead of taking, as the center of the area to query, a longitude and latitude value, it takes the name of a member already existing inside the geospatial index represented by the sorted set.georadiusByMember(String key, String member, double radius, GeoUnit unit, GeoRadiusParam param) This command is exactly likeGEORADIUSwith the sole difference that instead of taking, as the center of the area to query, a longitude and latitude value, it takes the name of a member already existing inside the geospatial index represented by the sorted set.georadiusByMemberReadonly(String key, String member, double radius, GeoUnit unit) Readonly version ofGEORADIUSBYMEMBERgeoradiusByMemberReadonly(String key, String member, double radius, GeoUnit unit, GeoRadiusParam param) Readonly version ofGEORADIUSBYMEMBERlonggeoradiusByMemberStore(String key, String member, double radius, GeoUnit unit, GeoRadiusParam param, GeoRadiusStoreParam storeParam) This command is exactly likeGEORADIUSBYMEMBERbut storing the results at the destination key (provided withstoreParam).georadiusReadonly(String key, double longitude, double latitude, double radius, GeoUnit unit) Readonly version ofGEORADIUS,georadiusReadonly(String key, double longitude, double latitude, double radius, GeoUnit unit, GeoRadiusParam param) Readonly version ofGEORADIUS,longgeoradiusStore(String key, double longitude, double latitude, double radius, GeoUnit unit, GeoRadiusParam param, GeoRadiusStoreParam storeParam) This command is exactly likeGEORADIUSbut storing the results at the destination key (provided withstoreParam).Return the members of a sorted set populated with geospatial information using GEOADD, which are within the borders of the area specified by a given shape.Return the members of a sorted set populated with geospatial information using GEOADD, which are within the borders of the area specified by a given shape.geosearch(String key, GeoCoordinate coord, double width, double height, GeoUnit unit) Return the members of a sorted set populated with geospatial information using GEOADD, which are within the borders of the area specified by a given shape.geosearch(String key, GeoCoordinate coord, double radius, GeoUnit unit) Return the members of a sorted set populated with geospatial information using GEOADD, which are within the borders of the area specified by a given shape.geosearch(String key, GeoSearchParam params) Return the members of a sorted set populated with geospatial information using GEOADD, which are within the borders of the area specified by a given shape.longgeosearchStore(String dest, String src, String member, double width, double height, GeoUnit unit) This command is exactly likeGEOSEARCHbut storing the results at dest.longgeosearchStore(String dest, String src, String member, double radius, GeoUnit unit) This command is exactly likeGEOSEARCHbut storing the results at dest.longgeosearchStore(String dest, String src, GeoCoordinate coord, double width, double height, GeoUnit unit) This command is exactly likeGEOSEARCHbut storing the results at dest.longgeosearchStore(String dest, String src, GeoCoordinate coord, double radius, GeoUnit unit) This command is exactly likeGEOSEARCHbut storing the results at dest.longgeosearchStore(String dest, String src, GeoSearchParam params) This command is exactly likeGEOSEARCHbut storing the results at dest.longgeosearchStoreStoreDist(String dest, String src, GeoSearchParam params) This command is exactly likeGEOSEARCHSTOREbut storing the results with their destinations from the center point.
-
Method Details
-
geoadd
Adds the specified geospatial item (longitude, latitude, member) to the specified key.Time complexity: O(log(N)) where N is the number of elements in the sorted set.
- Parameters:
key-longitude-latitude-member-- Returns:
- The number of elements added
-
geoadd
Adds the specified geospatial items (in memberCoordinateMap) to the specified key.Time complexity: O(log(N)) for each item added, where N is the number of elements in the sorted set.
- Parameters:
key-memberCoordinateMap- Members names with their geo coordinates- Returns:
- The number of elements added
-
geoadd
Adds the specified geospatial items (in memberCoordinateMap) to the specified key. Can be used with the following options: XX- Only update elements that already exist. Never add elements. NX- Don't update already existing elements. Always add new elements. CH- Modify the return value from the number of new elements added, to the total number of elements changedTime complexity: O(log(N)) for each item added
- Parameters:
key-params- Additional optionsmemberCoordinateMap- Members names with their geo coordinates- Returns:
- The number of elements added
-
geodist
Return the distance between two members in the geospatial index represented by the sorted set.Time complexity: O(log(N))
- Parameters:
key-member1-member2-- Returns:
- The distance as a double
-
geodist
Return the distance between two members in the geospatial index represented by the sorted set.Time complexity: O(log(N))
- Parameters:
key-member1-member2-unit- can be M, KM, MI or FT can M, KM, MI or FT- Returns:
- The distance as a double
-
geohash
Return valid Geohash strings representing the position of the given members.Time complexity: O(log(N)) for each member requested
- Parameters:
key-members-- Returns:
- A list of Geohash strings corresponding to each member name passed as argument to the command.
-
geopos
Return the positions (longitude,latitude) of all the specified members.Time complexity: O(N) where N is the number of members requested.
- Parameters:
key-members-- Returns:
- A list of GeoCoordinate representing longitude and latitude (x,y) of each member name passed as argument to the command.
-
georadius
List<GeoRadiusResponse> georadius(String key, double longitude, double latitude, double radius, GeoUnit unit) Return the members of a sorted set populated with geospatial information using GEOADD, which are within the borders of the area specified with the center location and the radius.Time complexity: O(N+log(M)) where N is the number of elements inside the bounding box of the circular area delimited by center and radius and M is the number of items inside the index.
- Parameters:
key-longitude- of the center pointlatitude- of the center pointradius- of the areaunit- can be M, KM, MI or FT- Returns:
- List of GeoRadiusResponse
-
georadiusReadonly
List<GeoRadiusResponse> georadiusReadonly(String key, double longitude, double latitude, double radius, GeoUnit unit) Readonly version ofGEORADIUS,Time complexity: O(N+log(M)) where N is the number of elements inside the bounding box of the circular area delimited by center and radius and M is the number of items inside the index.
- Parameters:
key-longitude- of the center pointlatitude- of the center pointradius- of the areaunit- can be M, KM, MI or FT- Returns:
- List of GeoRadiusResponse
- See Also:
-
georadius
List<GeoRadiusResponse> georadius(String key, double longitude, double latitude, double radius, GeoUnit unit, GeoRadiusParam param) Return the members of a sorted set populated with geospatial information using GEOADD, which are within the borders of the area specified with the center location and the radius. Additional information can be reached usingGeoRadiusParam: WITHDIST: Also return the distance of the returned items from the specified center. The distance is returned in the same unit as the unit specified as the radius argument of the command. WITHCOORD: Also return the longitude,latitude coordinates of the matching items. WITHHASH: Also return the raw geohash-encoded sorted set score of the item, in the form of a 52 bit unsigned integer. This is only useful for low level hacks or debugging and is otherwise of little interest for the general user.Time complexity: O(N+log(M)) where N is the number of elements inside the bounding box of the circular area delimited by center and radius and M is the number of items inside the index.
- Parameters:
key-longitude- of the center pointlatitude- of the center pointradius- of the areaunit- can be M, KM, MI or FTparam-GeoRadiusParam- Returns:
- List of GeoRadiusResponse
-
georadiusReadonly
List<GeoRadiusResponse> georadiusReadonly(String key, double longitude, double latitude, double radius, GeoUnit unit, GeoRadiusParam param) Readonly version ofGEORADIUS,Time complexity: O(N+log(M)) where N is the number of elements inside the bounding box of the circular area delimited by center and radius and M is the number of items inside the index.
- Parameters:
key-longitude- of the center pointlatitude- of the center pointradius- of the areaunit- can be M, KM, MI or FTparam-GeoRadiusParam- Returns:
- List of GeoRadiusResponse
- See Also:
-
georadiusByMember
This command is exactly likeGEORADIUSwith the sole difference that instead of taking, as the center of the area to query, a longitude and latitude value, it takes the name of a member already existing inside the geospatial index represented by the sorted set.Time complexity: O(N+log(M)) where N is the number of elements inside the bounding box of the circular area delimited by center and radius and M is the number of items inside the index.
- Parameters:
key-member- represents the center of the arearadius- of the areaunit- can be M, KM, MI or FT- Returns:
- List of GeoRadiusResponse
-
georadiusByMemberReadonly
List<GeoRadiusResponse> georadiusByMemberReadonly(String key, String member, double radius, GeoUnit unit) Readonly version ofGEORADIUSBYMEMBERTime complexity: O(N+log(M)) where N is the number of elements inside the bounding box of the circular area delimited by center and radius and M is the number of items inside the index.
- Parameters:
key-member- represents the center of the arearadius- of the areaunit- can be M, KM, MI or FT- Returns:
- List of GeoRadiusResponse
-
georadiusByMember
List<GeoRadiusResponse> georadiusByMember(String key, String member, double radius, GeoUnit unit, GeoRadiusParam param) This command is exactly likeGEORADIUSwith the sole difference that instead of taking, as the center of the area to query, a longitude and latitude value, it takes the name of a member already existing inside the geospatial index represented by the sorted set.Time complexity: O(N+log(M)) where N is the number of elements inside the bounding box of the circular area delimited by center and radius and M is the number of items inside the index.
- Parameters:
key-member- represents the center of the arearadius- of the areaunit- can be M, KM, MI or FTparam-GeoRadiusParam- Returns:
- List of GeoRadiusResponse
-
georadiusByMemberReadonly
List<GeoRadiusResponse> georadiusByMemberReadonly(String key, String member, double radius, GeoUnit unit, GeoRadiusParam param) Readonly version ofGEORADIUSBYMEMBERTime complexity: O(N+log(M)) where N is the number of elements inside the bounding box of the circular area delimited by center and radius and M is the number of items inside the index.
- Parameters:
key-member- represents the center of the arearadius- of the areaunit- can be M, KM, MI or FTparam-GeoRadiusParam- Returns:
- List of GeoRadiusResponse
-
georadiusStore
long georadiusStore(String key, double longitude, double latitude, double radius, GeoUnit unit, GeoRadiusParam param, GeoRadiusStoreParam storeParam) This command is exactly likeGEORADIUSbut storing the results at the destination key (provided withstoreParam).Time complexity: O(N+log(M)) where N is the number of elements inside the bounding box of the circular area delimited by center and radius and M is the number of items inside the index.
- Parameters:
key-longitude- of the center pointlatitude- of the center pointradius- of the areaunit- can be M, KM, MI or FTparam-GeoRadiusParamstoreParam-GeoRadiusStoreParam- Returns:
- The number of results being stored
-
georadiusByMemberStore
long georadiusByMemberStore(String key, String member, double radius, GeoUnit unit, GeoRadiusParam param, GeoRadiusStoreParam storeParam) This command is exactly likeGEORADIUSBYMEMBERbut storing the results at the destination key (provided withstoreParam).Time complexity: O(N+log(M)) where N is the number of elements inside the bounding box of the circular area delimited by center and radius and M is the number of items inside the index.
- Parameters:
key-member- represents the center of the arearadius- of the areaunit- can be M, KM, MI or FTparam-GeoRadiusParamstoreParam-GeoRadiusStoreParam- Returns:
- The number of results being stored
-
geosearch
Return the members of a sorted set populated with geospatial information using GEOADD, which are within the borders of the area specified by a given shape.This command can be used in place of the
GEORADIUSBYMEMBERcommand.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
- Parameters:
key-member- represents the center of the arearadius- of the areaunit- can be M, KM, MI or FT- Returns:
- List of GeoRadiusResponse
-
geosearch
Return the members of a sorted set populated with geospatial information using GEOADD, which are within the borders of the area specified by a given shape.This command can be used in place of the
GEORADIUScommand.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
- Parameters:
key-coord- represents the center of the arearadius- of the areaunit- can be M, KM, MI or FT- Returns:
- List of GeoRadiusResponse
-
geosearch
List<GeoRadiusResponse> geosearch(String key, String member, double width, double height, GeoUnit unit) Return the members of a sorted set populated with geospatial information using GEOADD, which are within the borders of the area specified by a given shape. This command extends the GEORADIUS command, so in addition to searching within circular areas, it supports searching within rectangular areas.The axis-aligned rectangle, determined by height and width, when the center point is determined by the position of the given member.
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
- Parameters:
key-member- represents the center of the areawidth- of the rectangular areaheight- of the rectangular areaunit- can be M, KM, MI or FT- Returns:
- List of GeoRadiusResponse
-
geosearch
List<GeoRadiusResponse> geosearch(String key, GeoCoordinate coord, double width, double height, GeoUnit unit) Return the members of a sorted set populated with geospatial information using GEOADD, which are within the borders of the area specified by a given shape. This command extends the GEORADIUS command, so in addition to searching within circular areas, it supports searching within rectangular areas.The axis-aligned rectangle, determined by height and width, when the center point is determined by the given coordinate.
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
- Parameters:
key-coord- represents the center pointwidth- of the rectangular areaheight- of the rectangular areaunit- can be M, KM, MI or FT- Returns:
- List of GeoRadiusResponse
-
geosearch
Return the members of a sorted set populated with geospatial information using GEOADD, which are within the borders of the area specified by a given shape. This command extends the GEORADIUS command, so in addition to searching within circular areas, it supports searching within rectangular areas.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
- Parameters:
key-params-GeoSearchParam- Returns:
- List of GeoRadiusResponse
-
geosearchStore
This command is exactly likeGEOSEARCHbut storing the results at dest.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
- Parameters:
dest-src- the sorted set (key)member- represents the center of the arearadius- of the circular areaunit- can be M, KM, MI or FT- Returns:
- The number of results being stored
-
geosearchStore
This command is exactly likeGEOSEARCHbut storing the results at dest.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
- Parameters:
dest-src-coord- represents the center pointradius- of the circular areaunit- can be M, KM, MI or FT- Returns:
- The number of results being stored
-
geosearchStore
long geosearchStore(String dest, String src, String member, double width, double height, GeoUnit unit) This command is exactly likeGEOSEARCHbut storing the results at dest.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
- Parameters:
dest-src-member- represents the center of the areawidth- of the rectangular areaheight- of the rectangular areaunit- can be M, KM, MI or FT- Returns:
- The number of results being stored
-
geosearchStore
long geosearchStore(String dest, String src, GeoCoordinate coord, double width, double height, GeoUnit unit) This command is exactly likeGEOSEARCHbut storing the results at dest.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
- Parameters:
dest-src-coord- represents the center pointwidth- of the rectangular areaheight- of the rectangular areaunit- can be M, KM, MI or FT- Returns:
- The number of results being stored
-
geosearchStore
This command is exactly likeGEOSEARCHbut storing the results at dest.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
- Parameters:
dest-src-params-GeoSearchParam- Returns:
- The number of results being stored
-
geosearchStoreStoreDist
This command is exactly likeGEOSEARCHSTOREbut storing the results with their destinations from the center point.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
- Parameters:
dest-src-params-GeoSearchParam- Returns:
- The number of results being stored
-