distance.php
Table of Contents
Functions
- distance() : string
- Return the distance between two coordinate pairs, in meters.
Functions
distance()
Return the distance between two coordinate pairs, in meters.
distance(float|int|string $latitude1, float|int|string $longitude1, float|int|string $latitude2, float|int|string $longitude2) : string
This helper wraps the ArangoDB AQL function DISTANCE(latitude1, longitude1, latitude2, longitude2) which computes the great-circle (haversine) distance
between two points given as separate scalar attributes. Unlike the GeoJSON
functions, DISTANCE takes its coordinates in the latitude-first order.
This is the index-accelerated form when a geo index is declared over the two
latitude / longitude attributes (geoJson: false), e.g. used in a
FILTER DISTANCE(...) <= @radius or SORT DISTANCE(...) ASC LIMIT n.
Example AQL usage:
DISTANCE(doc.geo.latitude, doc.geo.longitude, 48.8566, 2.3522)
Parameters
- $latitude1 : float|int|string
-
Latitude of the first point (or AQL expression).
- $longitude1 : float|int|string
-
Longitude of the first point (or AQL expression).
- $latitude2 : float|int|string
-
Latitude of the second point (or AQL expression).
- $longitude2 : float|int|string
-
Longitude of the second point (or AQL expression).
Tags
Return values
string —The formatted AQL expression.