geodist #
Returns the distance between two geospatial members of a key (see geoadd). The returned distance is expressed in meters by default.
geodist(key, member1, member2, [options], callback) #
Arguments | Type | Description |
---|---|---|
key | string | Key identifier |
member1 | string | Name of the first geospatial point |
member2 | string | Name of the second geospatial point |
options | JSON Object | Optional parameters |
callback | function | Callback |
Options #
Option | Type | Description | Default |
---|---|---|---|
queuable | boolean | Make this request queuable or not | true |
unit | string | Distance unit. Allowed values: m , km , mi , ft | m |
Callback Response #
Returns the calculated distance between the two provided geospatial points.
Usage #
<?php
use \Kuzzle\Kuzzle;
$kuzzle = new Kuzzle('localhost');
try {
$distance = $kuzzle->memoryStorage()->geodist('key', 'Palermo', 'Catania');
}
catch (ErrorException $e) {
}
Callback response:
166274.1516
Edit this page on Github(opens new window)