Documentation for agents: an index at /llms.txt, every docs page in one file at /llms-full.txt, and Markdown for any docs page by adding .md to its URL.

Effect KitRedis

Geo

Look up the geospatial commands, GeoQuery and the result types.

Geo commands store longitude and latitude pairs in a sorted set and search them by radius or box.

Example (Finding Nearby Places)

import {  } from "effect";

import {  } from "@effect-kit/redis";
import type {  } from "@effect-kit/redis";

const :  = {
  : { : 15, : 37 },
  : { : 200, : "km" },
  : "ASC",
};

const  = .(function* () {
  const  = yield* ;

  yield* .("places", [
    { : 13.361389, : 38.115556, : "palermo" },
    { : 15.087269, : 37.502669, : "catania" },
  ]);

  const near = yield* .("places", , { : true });
const near: readonly GeoResult[]
return ; });

geosearch returns member names as bytes. geosearchWith returns GeoResult values with the extra details you ask for.

Methods

MethodCommandReply typePurpose
redis.geoaddGEOADDbigintAdd members with coordinates.
redis.geoposGEOPOSreadonly Option<readonly [number, number]>[]Read member coordinates as longitude and latitude.
redis.geodistGEODISTOption<number>Return the distance between two members as a number.
redis.geodistTokenGEODISTOption<string>Return the distance as the server's decimal text.
redis.geohashGEOHASHreadonly Option<string>[]Return member geohash strings.
redis.geosearchGEOSEARCHreadonly Uint8Array[]Find members inside a circle or box.
redis.geosearchWithGEOSEARCHreadonly GeoResult[]Find members and include distance, hash or coordinates.
redis.geosearchstoreGEOSEARCHSTOREbigintStore the members found by a search in a key.
redis.georadiusGEORADIUSreadonly Uint8Array[]Find members within a radius of a point (older form).
redis.georadiusRoGEORADIUS_ROreadonly Uint8Array[]Find members within a radius of a point without writing.
redis.georadiusbymemberGEORADIUSBYMEMBERreadonly Uint8Array[]Find members within a radius of a member (older form).
redis.georadiusbymemberRoGEORADIUSBYMEMBER_ROreadonly Uint8Array[]Find members within a radius of a member without writing.
redis.georadiusWithGEORADIUS or GEORADIUSBYMEMBERreadonly GeoResult[]Radius search with distance, hash or coordinates, from a point or a member.
redis.georadiusStoreGEORADIUS or GEORADIUSBYMEMBERbigintRadius search that stores the result in a key.

GeoQuery

geosearch, geosearchWith and geosearchstore take a GeoQuery. origin is a member or a point, and area is a circle or a box.

Prop

Type

  • GeoUnit is "m" | "km" | "ft" | "mi".
  • GeoOrigin is the origin type above.
  • GeoSelection is { order?; count? }, used by the older georadius methods.
  • GeoDetails is { distance?: boolean; hash?: boolean; coordinates?: boolean }, used by the With methods.
  • GeoPosition is { longitude: number; latitude: number; member: string | Uint8Array }.
  • GeoAddOptions for geoadd is { condition?: "NX" | "XX"; changed?: boolean }.

GeoResult is the element of the With replies. Each detail is an Option and is None unless you asked for it.

Prop

Type

On this page