From 06cba6ccd165ca8b224797e37fccb9e63f026d77 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 21 Mar 2020 11:28:17 +0100 Subject: Adding upstream version 1.9.1. Signed-off-by: Daniel Baumann --- iredis/data/commands/geoencode.md | 57 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 iredis/data/commands/geoencode.md (limited to 'iredis/data/commands/geoencode.md') diff --git a/iredis/data/commands/geoencode.md b/iredis/data/commands/geoencode.md new file mode 100644 index 0000000..5e10af6 --- /dev/null +++ b/iredis/data/commands/geoencode.md @@ -0,0 +1,57 @@ +Geospatial Redis commands encode positions of objects in a single 52 bit +integer, using a technique called geohash. The encoding is further explained in +the `GEODECODE` and `GEOADD` documentation. The `GEOENCODE` command, documented +in this page, is able to convert a longitude and latitude pair into such 52 bit +integer, which is used as the _score_ for the sorted set members representing +geopositional information. + +Normally you don't need to use this command, unless you plan to implement low +level code in the client side interacting with the Redis geo commands. This +command may also be useful for debugging purposes. + +`GEOENCODE` takes as input: + +1. The longitude and latitude of a point on the Earth surface. +2. Optionally a radius represented by an integer and an unit. + +And returns a set of information, including the representation of the position +as a 52 bit integer, the min and max corners of the bounding box represented by +the geo hash, the center point in the area covered by the geohash integer, and +finally the two sorted set scores to query in order to retrieve all the elements +included in the geohash area. + +The radius optionally provided to the command is used in order to compute the +two scores returned by the command for range query purposes. Moreover the +returned geohash integer will only have the most significant bits set, according +to the number of bits needed to approximate the specified radius. + +## Use case + +As already specified this command is mostly not needed if not for debugging. +However there are actual use cases, which is, when there is to query for the +same areas multiple times, or with a different granularity or area shape +compared to what Redis `GEORADIUS` is able to provide, the client may implement +using this command part of the logic on the client side. Score ranges +representing given areas can be cached client side and used to retrieve elements +directly using `ZRANGEBYSCORE`. + +@return + +@array-reply, specifically: + +The command returns an array of give elements in the following order: + +- The 52 bit geohash +- min-longitude, min-latitude of the area identified +- max-longitude, max-latitude of the area identified +- center-longitude, center-latitude +- min-score and max-score of the sorted set to retrieve the members inside the + area + +@examples + +```cli +GEOADD Sicily 13.361389 38.115556 "Palermo" 15.087269 37.502669 "Catania" +ZSCORE Sicily "Palermo" +GEOENCODE 13.361389 38.115556 100 km +``` -- cgit v1.2.3