geoDistance.php
Table of Contents
Functions
- geoDistance() : string
- Return the distance between two GeoJSON geometries, in meters.
Functions
geoDistance()
Return the distance between two GeoJSON geometries, in meters.
geoDistance(array<string|int, mixed>|string $geo1, array<string|int, mixed>|string $geo2[, string|null $ellipsoid = null ]) : string
This helper wraps the ArangoDB AQL function GEO_DISTANCE(geoJson1, geoJson2, ellipsoid) which computes the shortest distance between two GeoJSON objects.
Both arguments are GeoJSON geometries (built with geoPoint(),
geoPolygon(), … or a document attribute), using the longitude-first
coordinate convention. The optional ellipsoid ("sphere" or "wgs84")
selects the reference model.
Example AQL usage:
GEO_DISTANCE(doc.geo, GEO_POINT(2.3522, 48.8566))
GEO_DISTANCE(doc.geo, @target, "wgs84")
Parameters
- $geo1 : array<string|int, mixed>|string
-
First GeoJSON geometry (AQL expression or
[longitude, latitude]). - $geo2 : array<string|int, mixed>|string
-
Second GeoJSON geometry (AQL expression or
[longitude, latitude]). - $ellipsoid : string|null = null
-
Optional reference ellipsoid:
"sphere"(default) or"wgs84".
Tags
Return values
string —The formatted AQL expression.