Oihana PHP Arango

withinRectangle.php

Table of Contents

Functions

withinRectangle()  : string
Return documents of a collection within a bounding rectangle (legacy).

Functions

withinRectangle()

Return documents of a collection within a bounding rectangle (legacy).

withinRectangle(string $collection, float|int|string $latitude1, float|int|string $longitude1, float|int|string $latitude2, float|int|string $longitude2) : string

This helper wraps the ArangoDB AQL function WITHIN_RECTANGLE(collection, latitude1, longitude1, latitude2, longitude2) which returns all documents located inside the rectangle defined by two opposite corners. The collection must have a geo index. Coordinates are given in the latitude-first order.

This is a legacy function; prefer a geo index combined with GeoJSON geoContains() over a polygon for new code.

Example AQL usage:

FOR place IN WITHIN_RECTANGLE(places, 48.80, 2.25, 48.90, 2.40) RETURN place
Parameters
$collection : string

The target collection name (AQL identifier).

$latitude1 : float|int|string

Latitude of the first corner (or AQL expression).

$longitude1 : float|int|string

Longitude of the first corner (or AQL expression).

$latitude2 : float|int|string

Latitude of the opposite corner (or AQL expression).

$longitude2 : float|int|string

Longitude of the opposite corner (or AQL expression).

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

$expr = withinRectangle( 'places' , 48.80 , 2.25 , 48.90 , 2.40 );
// Produces: 'WITHIN_RECTANGLE(places,48.8,2.25,48.9,2.4)'
see
https://docs.arangodb.com/stable/aql/functions/geo/#within_rectangle
since
1.0.0
author

Marc Alcaraz

Return values
string

The formatted AQL expression.

On this page

Search results