geoadd #
Adds geospatial points to the specified key.
geoadd(key, points, [options], [callback]) #
| Arguments | Type | Description |
|---|---|---|
key | string | Destination key identifier |
points | array of objects | List 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) |
options | JSON Object | Optional parameters |
callback | function | Callback |
Options #
| Option | Type | Description | Default |
|---|---|---|---|
queuable | boolean | Make this request queuable or not | true |
Return Value #
Returns the MemoryStorage object to allow chaining.
Callback Response #
Returns an integer containing the number of points added to the key.
Usage #
<?php
use \Kuzzle\Kuzzle;
$kuzzle = new Kuzzle('localhost');
$points = [
[
'lon' => 13.361389,
'lat' => 38.115556,
'name' => 'Palermo'
],
[
'lon' => 15.087269,
'lat' => 37.502669,
'name' => 'Catania'
]
];
try {
$count = $kuzzle->memoryStorage()->geoadd('key', points);
}
catch (ErrorException $e) {
}Callback response:
2