Oihana PHP Arango

resolveGeoPoint.php

Table of Contents

Functions

resolveGeoPoint()  : array{0: mixed, 1: mixed}
Resolve a `[ latitude, longitude ]` pair from a request-supplied object.

Functions

resolveGeoPoint()

Resolve a `[ latitude, longitude ]` pair from a request-supplied object.

resolveGeoPoint(mixed $value) : array{0: mixed, 1: mixed}

Reads the canonical Schema.org GeoCoordinates keys (latitude / longitude) first, then falls back to the short aliases (lat / lng / lon). Returns [ null, null ] when the value is not an array, or when a coordinate is missing — callers treat that as "no geo point".

Parameters
$value : mixed

The candidate object (typically a filter val or a ?near= payload).

Tags
example
use function oihana\arango\db\helpers\resolveGeoPoint;

resolveGeoPoint( [ 'latitude' => 48.85 , 'longitude' => 2.35 ] ) ; // [ 48.85, 2.35 ]
resolveGeoPoint( [ 'lat' => 48.85 , 'lng' => 2.35 ] ) ;            // [ 48.85, 2.35 ]
resolveGeoPoint( 'nope' ) ;                                        // [ null, null ]
since
1.0.0
author

Marc Alcaraz

Return values
array{0: mixed, 1: mixed}

The [ latitude, longitude ] pair.

On this page

Search results