Adds the specified geospatial items (longitude, latitude, name) to the specified key.
Adds the specified geospatial items (longitude, latitude, name) to the specified key. Data is stored into the key as a sorted set, in a way that makes it possible to later retrieve items using a query by radius with the GEORADIUS or GEORADIUSBYMEMBER commands.
The command takes arguments in the standard format x,y so the longitude must be specified before the latitude. There are limits to the coordinates that can be indexed: areas very near to the poles are not indexable. The exact limits, as specified by EPSG:900913 / EPSG:3785 / OSGEO:41001 are the following:
Valid longitudes are from -180 to 180 degrees. Valid latitudes are from -85.05112878 to 85.05112878 degrees.
The command will report an error when the user attempts to index coordinates outside the specified ranges.
Name of a sortedSet to which points will be added
points description consisting of 3 elements (longitude, latitude, name)
The number of elements added to the sorted set, not including elements already existing for which the score was updated.
client.geoAdd("GeoSet", GeoAddEntry(1.11, 2.22, "Paris"), GeoAddEntry(5.55, 6.66, "Berlin"))
3.2.0
scredis.exceptions.RedisErrorResponseException
if coordinates are out of expected range.
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.
Given a sorted set representing a geospatial index, populated using the GEOADD command, the command returns the distance between the two specified members in the specified unit.
Units: scredis.protocol.requests.GeoDistUnit
The distance is computed assuming that the Earth is a perfect sphere, so errors up to 0.5% are possible in edge cases.
client.geoAdd("GeoSet", GeoAddEntry(12.123, -3.321, "Chicago"), GeoAddEntry(-11.4, 3.99, "Prague")) client.geoDist("GeoSet", "Chicago", "Prague")
Name of a sortedSet from which members will be used
name present in 'key' set
name present in 'key' set
Measure unit used in response scredis.protocol.requests.GeoDistUnit
distance between two members in a set in specified measure unit or None if any of members not found in a set.
3.2.0
Return valid Geohash strings representing the position of one or more elements in a sorted set value representing a geospatial index (where elements were added using GEOADD).
Return valid Geohash strings representing the position of one or more elements in a sorted set value representing a geospatial index (where elements were added using GEOADD).
The command returns 11 characters Geohash strings, so no precision is loss compared to the Redis internal 52 bit representation. The returned Geohashes have the following properties:
They can be shortened removing characters from the right. It will lose precision but will still point to the same area. It is possible to use them in geohash.org URLs such as http://geohash.org/<geohash-string>. Strings with a similar prefix are nearby, but the contrary is not true, it is possible that strings with different prefixes are nearby too.
client.geoAdd("GeoSet", GeoAddEntry(1.11, 2.22, "Warsaw")) client.geoHash("GeoSet", "Warsaw", "unknownloc")
Name of a sortedSet from which members will be used
sequence of name entries present in set.
List with calculated geohash corresponding to each present member and None for not found members.
3.2.0
Return the positions (longitude,latitude) of all the specified members of the geospatial index represented by the sorted set at key.
Return the positions (longitude,latitude) of all the specified members of the geospatial index represented by the sorted set at key.
Given a sorted set representing a geospatial index, populated using the GEOADD command, it is often useful to obtain back the coordinates of specified members. When the geospatial index is populated via GEOADD the coordinates are converted into a 52 bit geohash, so the coordinates returned may not be exactly the ones used in order to add the elements, but small errors may be introduced.
client.geoAdd("GeoSet", GeoAddEntry(10, 10, "Paris")) client.geoPos("GeoSet", "Paris", "Unknown")
Name of a sortedSet from which members will be used
sequence of name entries present in set.
list where each entry represents coordinates (longitude, latitude) of corresponding member name or None if member is not found.
3.2.0
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 maximum distance from the center (the radius).
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 maximum distance from the center (the radius).
The common use case for this command is to retrieve geospatial items near a specified point not farther than a given amount of meters (or other units). This allows, for example, to suggest mobile users of an application nearby places.
client.geoAdd("GeoSet", GeoAddEntry(1.111, 1.5, "Tokyo"), GeoAddEntry(1.222, 1.6, "Kyoto"), GeoAddEntry(1.5, 1.333, "Nagasaki")) client.geoRadius("GeoSet", 1, 1, 3500, GeoDistUnit.km)
Name of a sortedSet in which points will be searched.
First coordinate of a point.
Second coordinate of a point.
Distance between given point and an edge of a circle. Specified in 'radiusUnit' units.
Units of measure in which radius is expressed scredis.protocol.requests.GeoDistUnit
List of member names from 'key' set.
3.2.0
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.
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.
The position of the specified member is used as the center of the query.
Name of a sortedSet in which points will be searched.
Name present in 'key' set
Radius in which returned elements are found. Specified in 'radiusUnit' units.
Units of measure in which radius is expressed scredis.protocol.requests.GeoDistUnit
List of member names from 'key' set.
3.2.0
scredis.exceptions.RedisErrorResponseException
if member is not found in set.
scredis.commands.GeoCommands.geoRadius
client.geoAdd("GeoSet", GeoAddEntry(1.111, 1.5, "Tokyo"), GeoAddEntry(1.222, 1.6, "Kyoto"), GeoAddEntry(1.5, 1.333, "Nagasaki")) client.geoRadiusByMember("GeoSet", "Tokyo", 60000, GeoDistUnit.km)