method

RedisClient.geodist

key: KeyLike,
member1: string,
member2: string
): Promise<null | string>;

Return the distance in meters between two members in the geospatial index

@param key

The key of the geo set

@param member1

The first member

@param member2

The second member

@returns

Promise that resolves with the distance as a string, or null if one or both members are missing

await redis.geodist("Sicily", "Palermo", "Catania"); // "166274.1516"
key: KeyLike,
member1: string,
member2: string,
unit: 'm' | 'km' | 'mi' | 'ft' | 'M' | 'KM' | 'MI' | 'FT'
): Promise<null | string>;

Return the distance between two members in the geospatial index

@param key

The key of the geo set

@param member1

The first member

@param member2

The second member

@param unit

The unit of the returned distance (m, km, mi, ft)

@returns

Promise that resolves with the distance as a string, or null if one or both members are missing

await redis.geodist("Sicily", "Palermo", "Catania", "km"); // "166.2742"

Referenced types

type KeyLike = string | ArrayBufferView | Blob