SDK
SDK Java v2.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.

geoadd #

Adds geospatial points to the specified key.

[Redis documentation]


geoadd(key, points, [options], [callback]) #

ArgumentsTypeDescription
keystringDestination key identifier
pointsarray of objectsList of geospatial points to add. Each point is described by a JSON object containing the following properties:
lon (longitude, float), lat (latitude, float), name (point identifier, string)
optionsJSON ObjectOptional parameters
callbackfunctionCallback

Options #

OptionTypeDescriptionDefault
queuablebooleanMake this request queuable or nottrue

Return Value #

Returns the MemoryStorage object to allow chaining.


Callback Response #

Returns an integer containing the number of points added to the key.

Usage #

JSONObject[] points = new JSONObject[]{
  new JSONObject()
    .put("lon", 13.361389)
    .put("lat", 38.115556)
    .put("name", "Palermo"),
  new JSONObject()
    .put("lon", 15.087269)
    .put("lat", 37.502669)
    .put("name", "Catania")
};
kuzzle.memoryStorage.geoadd("key", points, new ResponseListener<Long>() {
  @Override
  public void onSuccess(int count) {
    // callback called once the action has completed
  }
  @Override
  public void onError(JSONObject error) {
  }
});

Callback response:

2