Oihana PHP Arango

geoPolygon.php

Table of Contents

Functions

geoPolygon()  : string
Build a GeoJSON Polygon geometry.

Functions

geoPolygon()

Build a GeoJSON Polygon geometry.

geoPolygon(array<string|int, mixed>|string $points) : string

This helper wraps the ArangoDB AQL function GEO_POLYGON(points) which constructs a valid GeoJSON Polygon. The outer ring (and any holes) is an array of linear rings, each a closed list of [longitude, latitude] pairs (first and last coordinate must be equal). Coordinates must already follow the GeoJSON longitude-first convention.

Example AQL usage:

GEO_POLYGON([ [ [0,0], [1,0], [1,1], [0,1], [0,0] ] ])
Parameters
$points : array<string|int, mixed>|string

An array of linear rings, or an AQL expression.

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

$expr = geoPolygon( [ [ [ 0 , 0 ] , [ 1 , 0 ] , [ 1 , 1 ] , [ 0 , 0 ] ] ] );
// Produces: 'GEO_POLYGON([[[0,0],[1,0],[1,1],[0,0]]])'

$expr = geoPolygon( 'doc.area' );
// Produces: 'GEO_POLYGON(doc.area)'
see
https://docs.arangodb.com/stable/aql/functions/geo/#geo_polygon
since
1.0.0
author

Marc Alcaraz

Return values
string

The formatted AQL expression.

On this page

Search results