GEOHASH

GEOHASH key [member [member ...]]
Available since:
Redis Open Source 3.2.0
Time complexity:
O(1) for each member requested.
ACL categories:
@read, @geo, @slow,
Compatibility:
Redis Software and Redis Cloud compatibility

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).

Normally Redis represents positions of elements using a variation of the Geohash technique where positions are encoded using 52-bit integers. The encoding is also different compared to the standard because the initial minimum and maximum coordinates used during the encoding and decoding process are different. This command returns a standard Geohash in the form of a string as described in the Wikipedia article.

Required arguments

key

The name of the key that holds the geospatial index (a sorted set).

member [member ...]

One or more members whose Geohash strings to return.

Details

Geohash string properties

The command returns 11 character Geohash strings, so no precision is lost compared to the Redis internal 52-bit representation. The returned Geohashes have the following properties:

  1. They can be shortened by removing characters from the right. They will lose precision but will still point to the same area.
  2. Strings with a similar prefix are nearby, but the contrary is not true, it is possible that strings with different prefixes are nearby too.

Examples

GEOADD Sicily 13.361389 38.115556 "Palermo" 15.087269 37.502669 "Catania" GEOHASH Sicily Palermo Catania

Redis Software and Redis Cloud compatibility

Redis
Software
Redis
Cloud
Notes
✅ Standard
✅ Active-Active
✅ Standard
✅ Active-Active

Return information

Array reply: an array where each element is the Geohash corresponding to each member name passed as an argument to the command.
RATE THIS PAGE
Back to top ↑