{
  "schema_version": 2,
  "id": "commands/geosearchstore",
  "title": "GEOSEARCHSTORE",
  "url": "https://redis.io/docs/latest/commands/geosearchstore/",
  "summary": "Queries a geospatial index for members inside an area of a box or a circle, optionally stores the result.",
  "since": "6.2.0",
  "tags": [
    "docs",
    "develop",
    "stack",
    "oss",
    "rs",
    "rc",
    "oss",
    "kubernetes",
    "clients"
  ],
  "last_updated": "2026-09-18T09:48:43+01:00",
  "page_type": "content",
  "content_hash": "6b3a272905034504ce06d6748a48ed4bdcac8cfe24149551e5354489a7faa4da",
  "sections": [
    {
      "id": "overview",
      "title": "Overview",
      "role": "overview",
      "text": "> [!NOTE]\n> This command's behavior varies in clustered Redis environments. See the [multi-key operations](https://redis.io/docs/latest/develop/using-commands/multi-key-operations) page for more information.\n\n\nThis command is similar to [`GEOSEARCH`](https://redis.io/docs/latest/commands/geosearch), but it stores the result in the provided `destination`.\n\nThis command replaces the now deprecated [`GEORADIUS`](https://redis.io/docs/latest/commands/georadius) and [`GEORADIUSBYMEMBER`](https://redis.io/docs/latest/commands/georadiusbymember).\n\nBy default, it stores the results in the `destination` sorted set with their geospatial information.\n\nWhen using the `STOREDIST` option, the command stores the items in a sorted set populated with their distance from the center of the circle or box, as a floating-point number, in the same unit specified for that shape."
    },
    {
      "id": "required-arguments",
      "title": "Required arguments",
      "role": "content",
      "text": "<details open><summary><code>destination</code></summary>\n\nThe key to store the results in.\n\n</details>\n\n<details open><summary><code>source</code></summary>\n\nThe geospatial index key to search.\n\n</details>\n\nQuery center points:\n\n<details open><summary><code>FROMMEMBER member</code></summary>\n\nUse the position of the existing `member` as the center of the search. Mutually exclusive with `FROMLONLAT`.\n\n</details>\n\n<details open><summary><code>FROMLONLAT longitude latitude</code></summary>\n\nUse the given coordinates as the center of the search. Mutually exclusive with `FROMMEMBER`.\n\n</details>\n\nQuery shape options:\n\n<details open><summary><code>BYRADIUS radius M | KM | FT | MI</code></summary>\n\nSearch within a circle of the given `radius` in the specified unit. Mutually exclusive with `BYBOX`.\n\n</details>\n\n<details open><summary><code>BYBOX width height M | KM | FT | MI</code></summary>\n\nSearch within an axis-aligned box of the given `width` and `height` in the specified unit. Mutually exclusive with `BYRADIUS`.\n\n</details>"
    },
    {
      "id": "optional-arguments",
      "title": "Optional arguments",
      "role": "parameters",
      "text": "<details open><summary><code>ASC | DESC</code></summary>\n\nSort the results by distance from the center: nearest first (`ASC`) or farthest first (`DESC`).\n\n</details>\n\n<details open><summary><code>COUNT count [ANY]</code></summary>\n\nReturn at most `count` matches. With `ANY`, the command returns as soon as enough matches are found — faster, but the results may be unsorted.\n\n</details>\n\n<details open><summary><code>STOREDIST</code></summary>\n\nStore the distance from the center as the sorted-set score, instead of the geohash-encoded position.\n\n</details>"
    },
    {
      "id": "examples",
      "title": "Examples",
      "role": "example",
      "text": "redis> GEOADD Sicily 13.361389 38.115556 \"Palermo\" 15.087269 37.502669 \"Catania\"\n(integer) 2\nredis> GEOADD Sicily 12.758489 38.788135 \"edge1\"   17.241510 38.788135 \"edge2\"\n(integer) 2\nredis> GEOSEARCHSTORE key1 Sicily FROMLONLAT 15 37 BYBOX 400 400 km ASC COUNT 3\n(integer) 3\nredis> GEOSEARCH key1 FROMLONLAT 15 37 BYBOX 400 400 km ASC WITHCOORD WITHDIST WITHHASH\n1) 1) \"Catania\"\n   2) \"56.4413\"\n   3) (integer) 3479447370796909\n   4) 1) \"15.087267458438873\"\n      2) \"37.50266842333162\"\n2) 1) \"Palermo\"\n   2) \"190.4424\"\n   3) (integer) 3479099956230698\n   4) 1) \"13.361389338970184\"\n      2) \"38.1155563954963\"\n3) 1) \"edge2\"\n   2) \"279.7403\"\n   3) (integer) 3481342659049484\n   4) 1) \"17.241510450839996\"\n      2) \"38.78813451624225\"\nredis> GEOSEARCHSTORE key2 Sicily FROMLONLAT 15 37 BYBOX 400 400 km ASC COUNT 3 STOREDIST\n(integer) 3\nredis> ZRANGE key2 0 -1 WITHSCORES\n1) \"Catania\"\n2) \"56.4412578701582\"\n3) \"Palermo\"\n4) \"190.44242984775784\"\n5) \"edge2\"\n6) \"279.7403417843143\""
    },
    {
      "id": "redis-software-and-redis-cloud-compatibility",
      "title": "Redis Software and Redis Cloud compatibility",
      "role": "content",
      "text": "| Redis<br />Software | Redis<br />Cloud | <span style=\"min-width: 9em; display: table-cell\">Notes</span> |\n|:----------------------|:-----------------|:------|\n| <span title=\"Supported\">&#x2705; Standard</span><br /><span title=\"Supported\"><nobr>&#x2705; Active-Active</nobr></span> | <span title=\"Supported\">&#x2705; Standard</span><br /><span title=\"Supported\"><nobr>&#x2705; Active-Active</nobr></span> |  |"
    },
    {
      "id": "return-information",
      "title": "Return information",
      "role": "returns",
      "text": "**RESP2:**\n\n[Integer reply](../../develop/reference/protocol-spec#integers): the number of elements in the resulting set\n\n**RESP3:**\n\n[Integer reply](../../develop/reference/protocol-spec#integers): the number of elements in the resulting set"
    }
  ],
  "examples": []
}
