Core
API v1.x
1

You are currently looking at the documentation of a previous version of Kuzzle. We strongly recommend that you use the latest version. You can also use the version selector in the top menu.

georadiusbymember #

Returns the members (added with geoadd) of a given key inside the provided geospatial radius, centered around one of a key's member.

[Redis documentation]


Query Syntax #

HTTP #

Copied to clipboard!
URL: http://kuzzle:7512/ms/_georadiusbymember/<_id>?member=<member>&distance=<distance>&unit=[m|km|mi|ft][&options=option1,option2,...]
Method: GET

Other protocols #

Copied to clipboard!
{
  "controller": "ms",
  "action": "georadiusbymember",
  "_id": "<key>",
  "member": "kuzzle HQ",
  "distance": "1500"
  "unit": "m"
}

Arguments #

  • _id: key containing the geopoints to fetch
  • distance: distance from the center of the radius
  • member: name of the point used as the radius center
  • unit: unit of the distance parameter value. Allowed values: m, km, mi, ft

Optional: #

  • options: an array of one or multiple of the following values: withcoord, withdist, count <count>, asc and desc
  • asc: sort the results in ascending order (from the nearest member to the farthest one)
  • count: limit the number of returned results. The count value must be passed as a separate option (HTTP: &options=count,<count value>, Other protocols: options: ['count', <count value>])
  • desc: sort the results in descending order (from the farthest member to the nearest one)
  • withcoord: include the position of the matched geopoint, in the following format: [longitude, latitude]
  • withdist: include the calculated distance from the matched geopoint to the radius center

Response #

The response format depends on the passed options.

Without neither withcoord nor withdist, the response consists only of a list of points names:

Copied to clipboard!
{
 "requestId": "<unique request identifier>",
 "status": 200,
 "error": null,
 "controller": "ms",
 "action": "georadiusbymember",
 "collection": null,
 "index": null,
 "result": [
    "our other HQ",
    "kuzzle HQ"
 ]
}

With the withcoord option, points coordinates are included to the response (format: [longitude, latitude]):

Copied to clipboard!
{
  "requestId": "<unique request identifier>",
  "status": 200,
  "error": null,
  "controller": "ms",
  "action": "georadiusbymember",
  "collection": null,
  "index": null,
  "result": [
    [
      "our other HQ",
      [
        "3.89710754156112671",
        "43.60022152617014513"
      ]
    ],
    [
      "kuzzle HQ",
      [
        "3.91090482473373413",
        "43.607392252329916"
      ]
    ]
  ]
}

With the withdist option, the distance from the queried radius center is added to the response. The unit used for that distance is the same one than the one provided to the unit argument:

Copied to clipboard!
{
  "requestId": "<unique request identifier>",
  "status": 200,
  "error": null,
  "controller": "ms",
  "action": "georadius",
  "collection": null,
  "index": null,
  "result": [
    [
      "our other HQ",
      "1367.8521"
    ],
    [
      "kuzzle HQ",
      "0.0000"
    ]
  ]
}

With both the withcoord and the withdist options:

Copied to clipboard!
{
  "requestId": "<unique request identifier>",
  "status": 200,
  "error": null,
  "controller": "ms",
  "action": "georadiusbymember",
  "collection": null,
  "index": null,
  "result": [
    [
      "our other HQ",
      "1367.8521",
      [
        "3.89710754156112671",
        "43.60022152617014513"
      ]
    ],
    [
      "kuzzle HQ",
      "0.0000",
      [
        "3.91090482473373413",
        "43.607392252329916"
      ]
    ]
  ]
}