Skip to main content
Use GEODIST to get the distance between two members of a geospatial index. The unit defaults to meters and can be set to m, km, ft, or mi. The distance is a great-circle distance computed from the stored positions assuming the Earth is a sphere, so it carries the small error of the geohash encoding and, of course, says nothing about the distance actually travelled on roads. If either member is missing from the index the reply is null.

Syntax

Arguments

Important points

  • The distance is always returned as a bulk string, in both RESP2 and RESP3. Client libraries commonly decode it to a language number.

Response

The reply reports the result of the operation. Error replies have the same shape in RESP2 and RESP3 and are surfaced as exceptions by the SDKs below.
Client libraries often decode bulk strings, maps, sets, and numeric strings into language-native values. The table describes the Redis wire reply.

Examples

TCP examples use the TLS REDIS_URL from the Upstash console. REST examples use UPSTASH_REDIS_REST_URL and UPSTASH_REDIS_REST_TOKEN.