Interface GeoCommands

All Known Subinterfaces:
JedisCommands
All Known Implementing Classes:
Jedis, JedisCluster, JedisPooled, JedisSentineled, JedisSharding, UnifiedJedis

public interface GeoCommands
  • Method Details

    • geoadd

      long geoadd(String key, double longitude, double latitude, String member)
      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

      long geoadd(String key, Map<String,GeoCoordinate> memberCoordinateMap)
      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

      long geoadd(String key, GeoAddParams params, Map<String,GeoCoordinate> memberCoordinateMap)
      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 changed

      Time complexity: O(log(N)) for each item added

      Parameters:
      key -
      params - Additional options
      memberCoordinateMap - Members names with their geo coordinates
      Returns:
      The number of elements added
    • geodist

      Double geodist(String key, String member1, String member2)
      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

      Double geodist(String key, String member1, String member2, GeoUnit unit)
      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

      List<String> geohash(String key, String... members)
      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

      List<GeoCoordinate> geopos(String key, String... members)
      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 point
      latitude - of the center point
      radius - of the area
      unit - 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 of GEORADIUS,

      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 point
      latitude - of the center point
      radius - of the area
      unit - 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 using GeoRadiusParam: 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 point
      latitude - of the center point
      radius - of the area
      unit - can be M, KM, MI or FT
      param - GeoRadiusParam
      Returns:
      List of GeoRadiusResponse
    • georadiusReadonly

      List<GeoRadiusResponse> georadiusReadonly(String key, double longitude, double latitude, double radius, GeoUnit unit, GeoRadiusParam param)
      Readonly version of GEORADIUS,

      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 point
      latitude - of the center point
      radius - of the area
      unit - can be M, KM, MI or FT
      param - GeoRadiusParam
      Returns:
      List of GeoRadiusResponse
      See Also:
    • georadiusByMember

      List<GeoRadiusResponse> georadiusByMember(String key, String member, double radius, GeoUnit unit)
      This command is exactly like GEORADIUS with 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 area
      radius - of the area
      unit - 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 of GEORADIUSBYMEMBER

      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 area
      radius - of the area
      unit - 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 like GEORADIUS with 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 area
      radius - of the area
      unit - can be M, KM, MI or FT
      param - GeoRadiusParam
      Returns:
      List of GeoRadiusResponse
    • georadiusByMemberReadonly

      List<GeoRadiusResponse> georadiusByMemberReadonly(String key, String member, double radius, GeoUnit unit, GeoRadiusParam param)
      Readonly version of GEORADIUSBYMEMBER

      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 area
      radius - of the area
      unit - can be M, KM, MI or FT
      param - 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 like GEORADIUS but storing the results at the destination key (provided with storeParam).

      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 point
      latitude - of the center point
      radius - of the area
      unit - can be M, KM, MI or FT
      param - GeoRadiusParam
      storeParam - 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 like GEORADIUSBYMEMBER but storing the results at the destination key (provided with storeParam).

      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 area
      radius - of the area
      unit - can be M, KM, MI or FT
      param - GeoRadiusParam
      storeParam - GeoRadiusStoreParam
      Returns:
      The number of results being stored
    • geosearch

      List<GeoRadiusResponse> geosearch(String key, String member, 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.

      This command can be used in place of the GEORADIUSBYMEMBER command.

      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 area
      radius - of the area
      unit - can be M, KM, MI or FT
      Returns:
      List of GeoRadiusResponse
    • geosearch

      List<GeoRadiusResponse> 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.

      This command can be used in place of the GEORADIUS command.

      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 area
      radius - of the area
      unit - 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 area
      width - of the rectangular area
      height - of the rectangular area
      unit - 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 point
      width - of the rectangular area
      height - of the rectangular area
      unit - can be M, KM, MI or FT
      Returns:
      List of GeoRadiusResponse
    • geosearch

      List<GeoRadiusResponse> 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. 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

      long geosearchStore(String dest, String src, String member, double radius, GeoUnit unit)
      This command is exactly like GEOSEARCH but 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 area
      radius - of the circular area
      unit - can be M, KM, MI or FT
      Returns:
      The number of results being stored
    • geosearchStore

      long geosearchStore(String dest, String src, GeoCoordinate coord, double radius, GeoUnit unit)
      This command is exactly like GEOSEARCH but 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 point
      radius - of the circular area
      unit - 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 like GEOSEARCH but 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 area
      width - of the rectangular area
      height - of the rectangular area
      unit - 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 like GEOSEARCH but 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 point
      width - of the rectangular area
      height - of the rectangular area
      unit - can be M, KM, MI or FT
      Returns:
      The number of results being stored
    • geosearchStore

      long geosearchStore(String dest, String src, GeoSearchParam params)
      This command is exactly like GEOSEARCH but 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

      long geosearchStoreStoreDist(String dest, String src, GeoSearchParam params)
      This command is exactly like GEOSEARCHSTORE but 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