Oihana PHP Arango

geoPoint.php

Table of Contents

Functions

geoPoint()  : string
Build a GeoJSON Point geometry.

Functions

geoPoint()

Build a GeoJSON Point geometry.

geoPoint(float|int|string $latitude, float|int|string $longitude) : string

This helper wraps the ArangoDB AQL function GEO_POINT(longitude, latitude) which constructs a valid GeoJSON Point. Coordinates are accepted here in the human-friendly (latitude, longitude) order and reordered internally to the GeoJSON longitude-first convention expected by ArangoDB.

Example AQL usage:

GEO_POINT(2.3522, 48.8566)            // Paris, as [lng, lat]
GEO_POINT(doc.geo.longitude, doc.geo.latitude)
Parameters
$latitude : float|int|string

The latitude, or an AQL expression resolving to it.

$longitude : float|int|string

The longitude, or an AQL expression resolving to it.

Tags
example
use function oihana\arango\db\functions\geo\geoPoint;

$expr = geoPoint( 48.8566 , 2.3522 );
// Produces: 'GEO_POINT(2.3522,48.8566)'

$expr = geoPoint( 'doc.geo.latitude' , 'doc.geo.longitude' );
// Produces: 'GEO_POINT(doc.geo.longitude,doc.geo.latitude)'
see
https://docs.arangodb.com/stable/aql/functions/geo/#geo_point
since
1.0.0
author

Marc Alcaraz

Return values
string

The formatted AQL expression.

On this page

Search results