Redis › Geospatial Data in Redis

What is the underlying geohash based encoding that Redis uses to store geospatial data, and how does it affect the accuracy of location queries?

Advanced

Answer

Redis encodes latitude and longitude into a single fifty two bit integer using an interleaved geohash technique, which is then stored as the score in a sorted set, and while this encoding is highly precise for most practical purposes, extremely precise applications like scientific measurement should be aware that a small amount of precision loss can occur due to the encoding process.
-- The geohash encoding provides precision suitable
-- for most location based applications
GEOADD locations -122.4194 37.7749 'precise_point'
Real-world example A team building a highly precise surveying tool verifies that Redis's geospatial precision, while excellent for typical applications like store locators, does not quite meet their extremely strict scientific measurement accuracy requirements, choosing a specialized tool for that specific need instead.

Common follow-ups: How much precision loss is typical with Redis's geohash encoding?;What applications would actually be sensitive enough to this precision difference to matter?