SDK
SDK Javascript v5.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 #

Callback response, with the "withcoord" option:

[
  { "name": "Palermo", "coordinates": [13.361389338970184, 38.1155563954963] },
  { "name": "Catania", "coordinates": [15.087267458438873, 37.50266842333162] }
]

Callback response, with the "withdist" option:

[
  { "name": "Palermo", "distance": 190.4424 },
  { "name": "Catania", "distance": 56.4413 }
]

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]


georadiusbymember(key, member, distance, unit, [options], callback) #

ArgumentsTypeDescription
keystringKey identifier
memberstringName of the point to use as the center of the radius
distancedoubleMaximum distance from the center
unitstringDistance unit
optionsJSON ObjectOptional parameters
callbackfunctionCallback

Options #

OptionTypeDescriptionDefault
countintLimit the result set to count membersnull
queuablebooleanMake this request queuable or nottrue
sortstringReturn items from the nearest to the farthest to the center (ASC) or vice versa (DESC)null
withcoordbooleanAlso return the longitude and latitude coordinates of the matching itemsfalse
withdistbooleanAlso return the distance of the returned items from the specified center, in the same unit than the one provided with unitfalse

Callback Response #

Returns an array of names for points that are inside the provided radius.

Usage #

// Using callbacks (NodeJS or Web Browser)
kuzzle.memoryStorage.georadiusbymember('key', 'Palermo', 200, 'km', function (err, points) {
  // callback called once the action has completed
});
// Using promises (NodeJS only)
kuzzle.memoryStorage.georadiusbymemberPromise('key', 'Palermo', 200, 'km')
  .then(points => {
    // resolved once the action has completed
  });

Callback response:

[{ "name": "Palermo" }, { "name": "Catania" }]