├── lib └── LongitudeOne │ └── Spatial │ ├── Exception │ ├── UnsupportedTypeException.php │ ├── UnsupportedPlatformException.php │ ├── ExceptionInterface.php │ ├── MissingArgumentException.php │ ├── RangeException.php │ └── InvalidValueException.php │ ├── DBAL │ └── Types │ │ ├── Geography │ │ ├── PointType.php │ │ ├── PolygonType.php │ │ └── LineStringType.php │ │ ├── Geometry │ │ ├── PointType.php │ │ ├── PolygonType.php │ │ ├── LineStringType.php │ │ ├── MultiPointType.php │ │ ├── MultiPolygonType.php │ │ └── MultiLineStringType.php │ │ ├── DoctrineSpatialTypeInterface.php │ │ ├── GeometryType.php │ │ └── GeographyType.php │ ├── PHP │ └── Types │ │ ├── Geometry │ │ ├── GeometryInterface.php │ │ ├── Polygon.php │ │ ├── LineString.php │ │ ├── MultiPoint.php │ │ ├── MultiPolygon.php │ │ ├── MultiLineString.php │ │ └── Point.php │ │ ├── Geography │ │ ├── GeographyInterface.php │ │ ├── Polygon.php │ │ ├── LineString.php │ │ └── Point.php │ │ ├── PointInterface.php │ │ ├── LineStringInterface.php │ │ ├── MultiPointInterface.php │ │ ├── PolygonInterface.php │ │ ├── MultiLineStringInterface.php │ │ ├── MultiPolygonInterface.php │ │ ├── AbstractLineString.php │ │ ├── CartesianInterface.php │ │ ├── GeodeticInterface.php │ │ └── SpatialInterface.php │ └── ORM │ └── Query │ └── AST │ └── Functions │ ├── ReturnsGeometryInterface.php │ ├── PostgreSql │ ├── SpSrid.php │ ├── SpSimplify.php │ ├── SpGeometryType.php │ ├── SpDWithin.php │ ├── SpMakePoint.php │ ├── SpAzimuth.php │ ├── SpCollect.php │ ├── SpMakeBox2D.php │ ├── SpMakeEnvelope.php │ ├── SpSummary.php │ ├── SpCovers.php │ ├── SpTransform.php │ ├── SpGeogFromText.php │ ├── SpCoveredBy.php │ ├── SpGeomFromEwkt.php │ ├── SpContainsProperly.php │ ├── SpLineCrossingDirection.php │ ├── SpNPoints.php │ ├── SpAsGeoJson.php │ └── SpSplit.php │ ├── MySql │ ├── SpMbrContains.php │ ├── SpMbrDisjoint.php │ ├── SpGeometryType.php │ ├── SpMbrOverlaps.php │ ├── SpMbrEquals.php │ ├── SpDistance.php │ ├── SpLineString.php │ ├── SpPoint.php │ ├── SpMbrTouches.php │ ├── SpMbrWithin.php │ ├── SpMbrIntersects.php │ ├── SpBufferStrategy.php │ └── SpDistanceSphere.php │ ├── Standard │ ├── StBuffer.php │ ├── StGeometryType.php │ ├── StPoint.php │ ├── StDistance.php │ ├── StGeomFromWkb.php │ ├── StPolyFromWkb.php │ ├── StMLineFromWkb.php │ ├── StMPolyFromWkb.php │ ├── StPointFromWkb.php │ ├── StMPointFromWkb.php │ ├── StLineStringFromWkb.php │ ├── StNumInteriorRing.php │ ├── StArea.php │ ├── StPointN.php │ ├── StRelate.php │ ├── StContains.php │ ├── StIsClosed.php │ ├── StDimension.php │ └── StNumPoints.php │ ├── MariaDB │ ├── SpMbrDisjoint.php │ ├── SpMbrContains.php │ ├── SpGeometryType.php │ ├── SpMbrEquals.php │ ├── SpMbrOverlaps.php │ ├── SpDistance.php │ ├── SpLineString.php │ ├── SpPoint.php │ ├── SpMbrTouches.php │ ├── SpMbrWithin.php │ ├── SpMbrIntersects.php │ ├── StNumInteriorRings.php │ ├── SpDistanceSphere.php │ └── SpBuffer.php │ └── Common │ └── ScSrid.php └── LICENSE /lib/LongitudeOne/Spatial/Exception/UnsupportedTypeException.php: -------------------------------------------------------------------------------- 1 | 2017-2025 9 | * Copyright Longitude One 2020-2025 10 | * Copyright 2015 Derek J. Lambert 11 | * 12 | * For the full copyright and license information, please view the LICENSE 13 | * file that was distributed with this source code. 14 | * 15 | */ 16 | 17 | declare(strict_types=1); 18 | 19 | namespace LongitudeOne\Spatial\Exception; 20 | 21 | /** 22 | * UnsupportedPlatformException class. 23 | */ 24 | class UnsupportedTypeException extends \Exception implements ExceptionInterface 25 | { 26 | } 27 | -------------------------------------------------------------------------------- /lib/LongitudeOne/Spatial/DBAL/Types/Geography/PointType.php: -------------------------------------------------------------------------------- 1 | 2017-2025 9 | * Copyright Longitude One 2020-2025 10 | * Copyright 2015 Derek J. Lambert 11 | * 12 | * For the full copyright and license information, please view the LICENSE 13 | * file that was distributed with this source code. 14 | * 15 | */ 16 | 17 | declare(strict_types=1); 18 | 19 | namespace LongitudeOne\Spatial\DBAL\Types\Geography; 20 | 21 | use LongitudeOne\Spatial\DBAL\Types\GeographyType; 22 | 23 | /** 24 | * Doctrine POINT type. 25 | */ 26 | class PointType extends GeographyType 27 | { 28 | } 29 | -------------------------------------------------------------------------------- /lib/LongitudeOne/Spatial/DBAL/Types/Geometry/PointType.php: -------------------------------------------------------------------------------- 1 | 2017-2025 9 | * Copyright Longitude One 2020-2025 10 | * Copyright 2015 Derek J. Lambert 11 | * 12 | * For the full copyright and license information, please view the LICENSE 13 | * file that was distributed with this source code. 14 | * 15 | */ 16 | 17 | declare(strict_types=1); 18 | 19 | namespace LongitudeOne\Spatial\DBAL\Types\Geometry; 20 | 21 | use LongitudeOne\Spatial\DBAL\Types\GeometryType; 22 | 23 | /** 24 | * Doctrine POINT type. 25 | */ 26 | class PointType extends GeometryType 27 | { 28 | } 29 | -------------------------------------------------------------------------------- /lib/LongitudeOne/Spatial/Exception/UnsupportedPlatformException.php: -------------------------------------------------------------------------------- 1 | 2017-2025 9 | * Copyright Longitude One 2020-2025 10 | * Copyright 2015 Derek J. Lambert 11 | * 12 | * For the full copyright and license information, please view the LICENSE 13 | * file that was distributed with this source code. 14 | * 15 | */ 16 | 17 | declare(strict_types=1); 18 | 19 | namespace LongitudeOne\Spatial\Exception; 20 | 21 | /** 22 | * UnsupportedPlatformException class. 23 | */ 24 | class UnsupportedPlatformException extends \Exception implements ExceptionInterface 25 | { 26 | } 27 | -------------------------------------------------------------------------------- /lib/LongitudeOne/Spatial/DBAL/Types/Geometry/PolygonType.php: -------------------------------------------------------------------------------- 1 | 2017-2025 9 | * Copyright Longitude One 2020-2025 10 | * Copyright 2015 Derek J. Lambert 11 | * 12 | * For the full copyright and license information, please view the LICENSE 13 | * file that was distributed with this source code. 14 | * 15 | */ 16 | 17 | declare(strict_types=1); 18 | 19 | namespace LongitudeOne\Spatial\DBAL\Types\Geometry; 20 | 21 | use LongitudeOne\Spatial\DBAL\Types\GeometryType; 22 | 23 | /** 24 | * Doctrine POLYGON type. 25 | */ 26 | class PolygonType extends GeometryType 27 | { 28 | } 29 | -------------------------------------------------------------------------------- /lib/LongitudeOne/Spatial/DBAL/Types/Geography/PolygonType.php: -------------------------------------------------------------------------------- 1 | 2017-2025 9 | * Copyright Longitude One 2020-2025 10 | * Copyright 2015 Derek J. Lambert 11 | * 12 | * For the full copyright and license information, please view the LICENSE 13 | * file that was distributed with this source code. 14 | * 15 | */ 16 | 17 | declare(strict_types=1); 18 | 19 | namespace LongitudeOne\Spatial\DBAL\Types\Geography; 20 | 21 | use LongitudeOne\Spatial\DBAL\Types\GeographyType; 22 | 23 | /** 24 | * Doctrine POLYGON type. 25 | */ 26 | class PolygonType extends GeographyType 27 | { 28 | } 29 | -------------------------------------------------------------------------------- /lib/LongitudeOne/Spatial/DBAL/Types/Geography/LineStringType.php: -------------------------------------------------------------------------------- 1 | 2017-2025 9 | * Copyright Longitude One 2020-2025 10 | * Copyright 2015 Derek J. Lambert 11 | * 12 | * For the full copyright and license information, please view the LICENSE 13 | * file that was distributed with this source code. 14 | * 15 | */ 16 | 17 | declare(strict_types=1); 18 | 19 | namespace LongitudeOne\Spatial\DBAL\Types\Geography; 20 | 21 | use LongitudeOne\Spatial\DBAL\Types\GeographyType; 22 | 23 | /** 24 | * Doctrine LINESTRING type. 25 | */ 26 | class LineStringType extends GeographyType 27 | { 28 | } 29 | -------------------------------------------------------------------------------- /lib/LongitudeOne/Spatial/DBAL/Types/Geometry/LineStringType.php: -------------------------------------------------------------------------------- 1 | 2017-2025 9 | * Copyright Longitude One 2020-2025 10 | * Copyright 2015 Derek J. Lambert 11 | * 12 | * For the full copyright and license information, please view the LICENSE 13 | * file that was distributed with this source code. 14 | * 15 | */ 16 | 17 | declare(strict_types=1); 18 | 19 | namespace LongitudeOne\Spatial\DBAL\Types\Geometry; 20 | 21 | use LongitudeOne\Spatial\DBAL\Types\GeometryType; 22 | 23 | /** 24 | * Doctrine LINESTRING type. 25 | */ 26 | class LineStringType extends GeometryType 27 | { 28 | } 29 | -------------------------------------------------------------------------------- /lib/LongitudeOne/Spatial/DBAL/Types/Geometry/MultiPointType.php: -------------------------------------------------------------------------------- 1 | 2017-2025 9 | * Copyright Longitude One 2020-2025 10 | * Copyright 2015 Derek J. Lambert 11 | * 12 | * For the full copyright and license information, please view the LICENSE 13 | * file that was distributed with this source code. 14 | * 15 | */ 16 | 17 | declare(strict_types=1); 18 | 19 | namespace LongitudeOne\Spatial\DBAL\Types\Geometry; 20 | 21 | use LongitudeOne\Spatial\DBAL\Types\GeometryType; 22 | 23 | /** 24 | * Doctrine MULTIPOINT type. 25 | */ 26 | class MultiPointType extends GeometryType 27 | { 28 | } 29 | -------------------------------------------------------------------------------- /lib/LongitudeOne/Spatial/DBAL/Types/Geometry/MultiPolygonType.php: -------------------------------------------------------------------------------- 1 | 2017-2025 9 | * Copyright Longitude One 2020-2025 10 | * Copyright 2015 Derek J. Lambert 11 | * 12 | * For the full copyright and license information, please view the LICENSE 13 | * file that was distributed with this source code. 14 | * 15 | */ 16 | 17 | declare(strict_types=1); 18 | 19 | namespace LongitudeOne\Spatial\DBAL\Types\Geometry; 20 | 21 | use LongitudeOne\Spatial\DBAL\Types\GeometryType; 22 | 23 | /** 24 | * Doctrine MULTIPOLYGON type. 25 | */ 26 | class MultiPolygonType extends GeometryType 27 | { 28 | } 29 | -------------------------------------------------------------------------------- /lib/LongitudeOne/Spatial/Exception/ExceptionInterface.php: -------------------------------------------------------------------------------- 1 | 2017-2025 9 | * Copyright Longitude One 2020-2025 10 | * Copyright 2015 Derek J. Lambert 11 | * 12 | * For the full copyright and license information, please view the LICENSE 13 | * file that was distributed with this source code. 14 | * 15 | */ 16 | 17 | declare(strict_types=1); 18 | 19 | namespace LongitudeOne\Spatial\Exception; 20 | 21 | /** 22 | * Exception interface. 23 | * 24 | * Any exceptions to the Spatial library must implement this interface. 25 | */ 26 | interface ExceptionInterface extends \Throwable 27 | { 28 | } 29 | -------------------------------------------------------------------------------- /lib/LongitudeOne/Spatial/DBAL/Types/Geometry/MultiLineStringType.php: -------------------------------------------------------------------------------- 1 | 2017-2025 9 | * Copyright Longitude One 2020-2025 10 | * Copyright 2015 Derek J. Lambert 11 | * 12 | * For the full copyright and license information, please view the LICENSE 13 | * file that was distributed with this source code. 14 | * 15 | */ 16 | 17 | declare(strict_types=1); 18 | 19 | namespace LongitudeOne\Spatial\DBAL\Types\Geometry; 20 | 21 | use LongitudeOne\Spatial\DBAL\Types\GeometryType; 22 | 23 | /** 24 | * Doctrine MULTILineString type. 25 | */ 26 | class MultiLineStringType extends GeometryType 27 | { 28 | } 29 | -------------------------------------------------------------------------------- /lib/LongitudeOne/Spatial/PHP/Types/Geometry/GeometryInterface.php: -------------------------------------------------------------------------------- 1 | 2017-2025 9 | * Copyright Longitude One 2020-2025 10 | * Copyright 2015 Derek J. Lambert 11 | * 12 | * For the full copyright and license information, please view the LICENSE 13 | * file that was distributed with this source code. 14 | * 15 | */ 16 | 17 | declare(strict_types=1); 18 | 19 | namespace LongitudeOne\Spatial\PHP\Types\Geometry; 20 | 21 | use LongitudeOne\Spatial\PHP\Types\SpatialInterface; 22 | 23 | /** 24 | * Geometry interface for any Geometry objects. 25 | */ 26 | interface GeometryInterface extends SpatialInterface 27 | { 28 | } 29 | -------------------------------------------------------------------------------- /lib/LongitudeOne/Spatial/Exception/MissingArgumentException.php: -------------------------------------------------------------------------------- 1 | 2017-2025 9 | * Copyright Longitude One 2020-2025 10 | * Copyright 2015 Derek J. Lambert 11 | * 12 | * For the full copyright and license information, please view the LICENSE 13 | * file that was distributed with this source code. 14 | * 15 | */ 16 | 17 | declare(strict_types=1); 18 | 19 | namespace LongitudeOne\Spatial\Exception; 20 | 21 | /** 22 | * MissingArgumentException class. 23 | * 24 | * This exception is thrown when an argument is missing. 25 | */ 26 | class MissingArgumentException extends \Exception implements ExceptionInterface 27 | { 28 | } 29 | -------------------------------------------------------------------------------- /lib/LongitudeOne/Spatial/PHP/Types/Geography/GeographyInterface.php: -------------------------------------------------------------------------------- 1 | 2017-2025 9 | * Copyright Longitude One 2020-2025 10 | * Copyright 2015 Derek J. Lambert 11 | * 12 | * For the full copyright and license information, please view the LICENSE 13 | * file that was distributed with this source code. 14 | * 15 | */ 16 | 17 | declare(strict_types=1); 18 | 19 | namespace LongitudeOne\Spatial\PHP\Types\Geography; 20 | 21 | use LongitudeOne\Spatial\PHP\Types\SpatialInterface; 22 | 23 | /** 24 | * Geography interface for any Geography objects. 25 | */ 26 | interface GeographyInterface extends SpatialInterface 27 | { 28 | } 29 | -------------------------------------------------------------------------------- /lib/LongitudeOne/Spatial/ORM/Query/AST/Functions/ReturnsGeometryInterface.php: -------------------------------------------------------------------------------- 1 | 2017-2025 9 | * Copyright Longitude One 2020-2025 10 | * Copyright 2015 Derek J. Lambert 11 | * 12 | * For the full copyright and license information, please view the LICENSE 13 | * file that was distributed with this source code. 14 | * 15 | */ 16 | 17 | declare(strict_types=1); 18 | 19 | namespace LongitudeOne\Spatial\ORM\Query\AST\Functions; 20 | 21 | /** 22 | * Interface to indicate function returns a geometry value. 23 | * 24 | * @author Derek J. Lambert 25 | * @license https://dlambert.mit-license.org MIT 26 | */ 27 | interface ReturnsGeometryInterface 28 | { 29 | } 30 | -------------------------------------------------------------------------------- /lib/LongitudeOne/Spatial/PHP/Types/Geometry/Polygon.php: -------------------------------------------------------------------------------- 1 | 2017-2025 9 | * Copyright Longitude One 2020-2025 10 | * Copyright 2015 Derek J. Lambert 11 | * 12 | * For the full copyright and license information, please view the LICENSE 13 | * file that was distributed with this source code. 14 | * 15 | */ 16 | 17 | declare(strict_types=1); 18 | 19 | namespace LongitudeOne\Spatial\PHP\Types\Geometry; 20 | 21 | use LongitudeOne\Spatial\PHP\Types\AbstractPolygon; 22 | use LongitudeOne\Spatial\PHP\Types\PolygonInterface; 23 | 24 | /** 25 | * Polygon object for the POLYGON geometry type. 26 | */ 27 | class Polygon extends AbstractPolygon implements GeometryInterface, PolygonInterface 28 | { 29 | } 30 | -------------------------------------------------------------------------------- /lib/LongitudeOne/Spatial/PHP/Types/Geography/Polygon.php: -------------------------------------------------------------------------------- 1 | 2017-2025 9 | * Copyright Longitude One 2020-2025 10 | * Copyright 2015 Derek J. Lambert 11 | * 12 | * For the full copyright and license information, please view the LICENSE 13 | * file that was distributed with this source code. 14 | * 15 | */ 16 | 17 | declare(strict_types=1); 18 | 19 | namespace LongitudeOne\Spatial\PHP\Types\Geography; 20 | 21 | use LongitudeOne\Spatial\PHP\Types\AbstractPolygon; 22 | use LongitudeOne\Spatial\PHP\Types\PolygonInterface; 23 | 24 | /** 25 | * Polygon object for the POLYGON geography type. 26 | */ 27 | class Polygon extends AbstractPolygon implements GeographyInterface, PolygonInterface 28 | { 29 | } 30 | -------------------------------------------------------------------------------- /lib/LongitudeOne/Spatial/PHP/Types/Geography/LineString.php: -------------------------------------------------------------------------------- 1 | 2017-2025 9 | * Copyright Longitude One 2020-2025 10 | * Copyright 2015 Derek J. Lambert 11 | * 12 | * For the full copyright and license information, please view the LICENSE 13 | * file that was distributed with this source code. 14 | * 15 | */ 16 | 17 | declare(strict_types=1); 18 | 19 | namespace LongitudeOne\Spatial\PHP\Types\Geography; 20 | 21 | use LongitudeOne\Spatial\PHP\Types\AbstractLineString; 22 | use LongitudeOne\Spatial\PHP\Types\LineStringInterface; 23 | 24 | /** 25 | * LineString object for LINESTRING geography type. 26 | */ 27 | class LineString extends AbstractLineString implements GeographyInterface, LineStringInterface 28 | { 29 | } 30 | -------------------------------------------------------------------------------- /lib/LongitudeOne/Spatial/PHP/Types/Geometry/LineString.php: -------------------------------------------------------------------------------- 1 | 2017-2025 9 | * Copyright Longitude One 2020-2025 10 | * Copyright 2015 Derek J. Lambert 11 | * 12 | * For the full copyright and license information, please view the LICENSE 13 | * file that was distributed with this source code. 14 | * 15 | */ 16 | 17 | declare(strict_types=1); 18 | 19 | namespace LongitudeOne\Spatial\PHP\Types\Geometry; 20 | 21 | use LongitudeOne\Spatial\PHP\Types\AbstractLineString; 22 | use LongitudeOne\Spatial\PHP\Types\LineStringInterface; 23 | 24 | /** 25 | * LineString object for the LINESTRING geometry type. 26 | */ 27 | class LineString extends AbstractLineString implements GeometryInterface, LineStringInterface 28 | { 29 | } 30 | -------------------------------------------------------------------------------- /lib/LongitudeOne/Spatial/PHP/Types/Geometry/MultiPoint.php: -------------------------------------------------------------------------------- 1 | 2017-2025 9 | * Copyright Longitude One 2020-2025 10 | * Copyright 2015 Derek J. Lambert 11 | * 12 | * For the full copyright and license information, please view the LICENSE 13 | * file that was distributed with this source code. 14 | * 15 | */ 16 | 17 | declare(strict_types=1); 18 | 19 | namespace LongitudeOne\Spatial\PHP\Types\Geometry; 20 | 21 | use LongitudeOne\Spatial\PHP\Types\AbstractMultiPoint; 22 | use LongitudeOne\Spatial\PHP\Types\MultiPointInterface; 23 | 24 | /** 25 | * MultiPoint object for the MULTIPOINT geometry type. 26 | */ 27 | class MultiPoint extends AbstractMultiPoint implements GeometryInterface, MultiPointInterface 28 | { 29 | } 30 | -------------------------------------------------------------------------------- /lib/LongitudeOne/Spatial/PHP/Types/PointInterface.php: -------------------------------------------------------------------------------- 1 | 2017-2025 9 | * Copyright Longitude One 2020-2025 10 | * Copyright 2015 Derek J. Lambert 11 | * 12 | * For the full copyright and license information, please view the LICENSE 13 | * file that was distributed with this source code. 14 | * 15 | */ 16 | 17 | declare(strict_types=1); 18 | 19 | namespace LongitudeOne\Spatial\PHP\Types; 20 | 21 | interface PointInterface extends SpatialInterface 22 | { 23 | /** 24 | * Convert point to its array representation. 25 | * 26 | * Array does NOT contain SpatialInterface, only floats, integers, and arrays. 27 | * 28 | * @return (float|int)[] 29 | */ 30 | public function toArray(): array; 31 | } 32 | -------------------------------------------------------------------------------- /lib/LongitudeOne/Spatial/PHP/Types/Geometry/MultiPolygon.php: -------------------------------------------------------------------------------- 1 | 2017-2025 9 | * Copyright Longitude One 2020-2025 10 | * Copyright 2015 Derek J. Lambert 11 | * 12 | * For the full copyright and license information, please view the LICENSE 13 | * file that was distributed with this source code. 14 | * 15 | */ 16 | 17 | declare(strict_types=1); 18 | 19 | namespace LongitudeOne\Spatial\PHP\Types\Geometry; 20 | 21 | use LongitudeOne\Spatial\PHP\Types\AbstractMultiPolygon; 22 | use LongitudeOne\Spatial\PHP\Types\MultiPolygonInterface; 23 | 24 | /** 25 | * MultiPolygon object for the MULTIPOLYGON geometry type. 26 | */ 27 | class MultiPolygon extends AbstractMultiPolygon implements GeometryInterface, MultiPolygonInterface 28 | { 29 | } 30 | -------------------------------------------------------------------------------- /lib/LongitudeOne/Spatial/PHP/Types/LineStringInterface.php: -------------------------------------------------------------------------------- 1 | 2017-2025 9 | * Copyright Longitude One 2020-2025 10 | * Copyright 2015 Derek J. Lambert 11 | * 12 | * For the full copyright and license information, please view the LICENSE 13 | * file that was distributed with this source code. 14 | * 15 | */ 16 | 17 | declare(strict_types=1); 18 | 19 | namespace LongitudeOne\Spatial\PHP\Types; 20 | 21 | interface LineStringInterface extends SpatialInterface 22 | { 23 | /** 24 | * Convert lineString to its array representation. 25 | * 26 | * Array does NOT contain SpatialInterface, only floats, integers, and arrays. 27 | * 28 | * @return (float|int)[][] 29 | */ 30 | public function toArray(): array; 31 | } 32 | -------------------------------------------------------------------------------- /lib/LongitudeOne/Spatial/PHP/Types/MultiPointInterface.php: -------------------------------------------------------------------------------- 1 | 2017-2025 9 | * Copyright Longitude One 2020-2025 10 | * Copyright 2015 Derek J. Lambert 11 | * 12 | * For the full copyright and license information, please view the LICENSE 13 | * file that was distributed with this source code. 14 | * 15 | */ 16 | 17 | declare(strict_types=1); 18 | 19 | namespace LongitudeOne\Spatial\PHP\Types; 20 | 21 | interface MultiPointInterface extends SpatialInterface 22 | { 23 | /** 24 | * Convert multipoint to its array representation. 25 | * 26 | * Array does NOT contain SpatialInterface, only floats, integers, and arrays. 27 | * 28 | * @return (float|int)[][] 29 | */ 30 | public function toArray(): array; 31 | } 32 | -------------------------------------------------------------------------------- /lib/LongitudeOne/Spatial/PHP/Types/PolygonInterface.php: -------------------------------------------------------------------------------- 1 | 2017-2025 9 | * Copyright Longitude One 2020-2025 10 | * Copyright 2015 Derek J. Lambert 11 | * 12 | * For the full copyright and license information, please view the LICENSE 13 | * file that was distributed with this source code. 14 | * 15 | */ 16 | 17 | declare(strict_types=1); 18 | 19 | namespace LongitudeOne\Spatial\PHP\Types; 20 | 21 | interface PolygonInterface extends SpatialInterface 22 | { 23 | /** 24 | * Convert any spatial polygon to its array representation. 25 | * 26 | * Array does NOT contain SpatialInterface, only floats, integers, and arrays. 27 | * 28 | * @return (float|int)[][][] 29 | */ 30 | public function toArray(): array; 31 | } 32 | -------------------------------------------------------------------------------- /lib/LongitudeOne/Spatial/Exception/RangeException.php: -------------------------------------------------------------------------------- 1 | 2017-2025 9 | * Copyright Longitude One 2020-2025 10 | * Copyright 2015 Derek J. Lambert 11 | * 12 | * For the full copyright and license information, please view the LICENSE 13 | * file that was distributed with this source code. 14 | * 15 | */ 16 | 17 | declare(strict_types=1); 18 | 19 | namespace LongitudeOne\Spatial\Exception; 20 | 21 | /** 22 | * Range Exception class. 23 | * 24 | * This exception is thrown when a geodesic coordinate is out of range. 25 | * 26 | * @internal the library uses this exception internally and is always caught to throw a more explicit InvalidValueException 27 | */ 28 | final class RangeException extends \Exception implements ExceptionInterface 29 | { 30 | } 31 | -------------------------------------------------------------------------------- /lib/LongitudeOne/Spatial/PHP/Types/Geometry/MultiLineString.php: -------------------------------------------------------------------------------- 1 | 2017-2025 9 | * Copyright Longitude One 2020-2025 10 | * Copyright 2015 Derek J. Lambert 11 | * 12 | * For the full copyright and license information, please view the LICENSE 13 | * file that was distributed with this source code. 14 | * 15 | */ 16 | 17 | declare(strict_types=1); 18 | 19 | namespace LongitudeOne\Spatial\PHP\Types\Geometry; 20 | 21 | use LongitudeOne\Spatial\PHP\Types\AbstractMultiLineString; 22 | use LongitudeOne\Spatial\PHP\Types\MultiLineStringInterface; 23 | 24 | /** 25 | * MultiLineString object for the MULTILINESTRING geometry type. 26 | */ 27 | class MultiLineString extends AbstractMultiLineString implements GeometryInterface, MultiLineStringInterface 28 | { 29 | } 30 | -------------------------------------------------------------------------------- /lib/LongitudeOne/Spatial/ORM/Query/AST/Functions/PostgreSql/SpSrid.php: -------------------------------------------------------------------------------- 1 | 2017-2025 9 | * Copyright Longitude One 2020-2025 10 | * Copyright 2015 Derek J. Lambert 11 | * 12 | * For the full copyright and license information, please view the LICENSE 13 | * file that was distributed with this source code. 14 | * 15 | */ 16 | 17 | declare(strict_types=1); 18 | 19 | namespace LongitudeOne\Spatial\ORM\Query\AST\Functions\PostgreSql; 20 | 21 | use LongitudeOne\Spatial\ORM\Query\AST\Functions\Common\ScSrid as CommonScSrid; 22 | 23 | /** 24 | * ST_SRID DQL function. 25 | * 26 | * @author Alexandre Tranchant 27 | * @license https://alexandre-tranchant.mit-license.org MIT 28 | */ 29 | class SpSrid extends CommonScSrid 30 | { 31 | } 32 | -------------------------------------------------------------------------------- /lib/LongitudeOne/Spatial/PHP/Types/MultiLineStringInterface.php: -------------------------------------------------------------------------------- 1 | 2017-2025 9 | * Copyright Longitude One 2020-2025 10 | * Copyright 2015 Derek J. Lambert 11 | * 12 | * For the full copyright and license information, please view the LICENSE 13 | * file that was distributed with this source code. 14 | * 15 | */ 16 | 17 | declare(strict_types=1); 18 | 19 | namespace LongitudeOne\Spatial\PHP\Types; 20 | 21 | interface MultiLineStringInterface extends SpatialInterface 22 | { 23 | /** 24 | * Convert multi-line-string to its array representation. 25 | * 26 | * Array does NOT contain SpatialInterface, only floats, integers, and arrays. 27 | * 28 | * @return (float|int)[][][] 29 | */ 30 | public function toArray(): array; 31 | } 32 | -------------------------------------------------------------------------------- /lib/LongitudeOne/Spatial/PHP/Types/MultiPolygonInterface.php: -------------------------------------------------------------------------------- 1 | 2017-2025 9 | * Copyright Longitude One 2020-2025 10 | * Copyright 2015 Derek J. Lambert 11 | * 12 | * For the full copyright and license information, please view the LICENSE 13 | * file that was distributed with this source code. 14 | * 15 | */ 16 | 17 | declare(strict_types=1); 18 | 19 | namespace LongitudeOne\Spatial\PHP\Types; 20 | 21 | interface MultiPolygonInterface extends SpatialInterface 22 | { 23 | /** 24 | * Convert any multi-polygon object to its array representation. 25 | * 26 | * Array does NOT contain SpatialInterface, only floats, integers, and arrays. 27 | * 28 | * @return (float|int)[][][][] 29 | */ 30 | public function toArray(): array; 31 | } 32 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | (c) Alexandre Tranchant 2017 - 2021 2 | (c) Longitude One 2020 - 2021 3 | (c) 2015 Derek J. Lambert 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /lib/LongitudeOne/Spatial/DBAL/Types/DoctrineSpatialTypeInterface.php: -------------------------------------------------------------------------------- 1 | 2017-2025 9 | * Copyright Longitude One 2020-2025 10 | * Copyright 2015 Derek J. Lambert 11 | * 12 | * For the full copyright and license information, please view the LICENSE 13 | * file that was distributed with this source code. 14 | * 15 | */ 16 | 17 | declare(strict_types=1); 18 | 19 | namespace LongitudeOne\Spatial\DBAL\Types; 20 | 21 | use LongitudeOne\Spatial\DBAL\Platform\PlatformInterface; 22 | 23 | interface DoctrineSpatialTypeInterface 24 | { 25 | /** 26 | * Return (SpatialInterface::GEOGRAPHY|SpatialInterface::GEOMETRY) the family of the type. 27 | * 28 | * @return ('Geography'|'Geometry') 29 | */ 30 | public function getTypeFamily(): string; 31 | 32 | /** 33 | * Is this type supported by the specified database platform? 34 | * 35 | * @param PlatformInterface $platform The specified database platform 36 | */ 37 | public function supportsPlatform(PlatformInterface $platform): bool; 38 | } 39 | -------------------------------------------------------------------------------- /lib/LongitudeOne/Spatial/PHP/Types/AbstractLineString.php: -------------------------------------------------------------------------------- 1 | 2017-2025 9 | * Copyright Longitude One 2020-2025 10 | * Copyright 2015 Derek J. Lambert 11 | * 12 | * For the full copyright and license information, please view the LICENSE 13 | * file that was distributed with this source code. 14 | * 15 | */ 16 | 17 | declare(strict_types=1); 18 | 19 | namespace LongitudeOne\Spatial\PHP\Types; 20 | 21 | /** 22 | * Abstract LineString object for LINESTRING spatial types. 23 | */ 24 | abstract class AbstractLineString extends AbstractMultiPoint 25 | { 26 | /** 27 | * Type of this geometry: Linestring. 28 | */ 29 | public function getType(): string 30 | { 31 | return self::LINESTRING; 32 | } 33 | 34 | /** 35 | * This line string is closed when the first point is the same as the last point. 36 | */ 37 | public function isClosed(): bool 38 | { 39 | if (count($this->points) < 2) { 40 | return false; 41 | } 42 | 43 | return $this->points[0] === $this->points[count($this->points) - 1]; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /lib/LongitudeOne/Spatial/Exception/InvalidValueException.php: -------------------------------------------------------------------------------- 1 | 2017-2025 9 | * Copyright Longitude One 2020-2025 10 | * Copyright 2015 Derek J. Lambert 11 | * 12 | * For the full copyright and license information, please view the LICENSE 13 | * file that was distributed with this source code. 14 | * 15 | */ 16 | 17 | declare(strict_types=1); 18 | 19 | namespace LongitudeOne\Spatial\Exception; 20 | 21 | /** 22 | * InvalidValueException class. 23 | * 24 | * This exception is thrown when a geometric or geographic value is invalid. 25 | */ 26 | class InvalidValueException extends \Exception implements ExceptionInterface 27 | { 28 | public const OUT_OF_RANGE_LATITUDE = 'Out of range latitude value, latitude must be between -90 and 90, got "%s".'; 29 | public const OUT_OF_RANGE_LONGITUDE = 'Out of range longitude value, longitude must be between -180 and 180, got "%s".'; 30 | public const OUT_OF_RANGE_MINUTE = 'Out of range minute value, minute must be between 0 and 59, got "%s".'; 31 | public const OUT_OF_RANGE_SECOND = 'Out of range second value, second must be between 0 and 59, got "%s".'; 32 | } 33 | -------------------------------------------------------------------------------- /lib/LongitudeOne/Spatial/DBAL/Types/GeometryType.php: -------------------------------------------------------------------------------- 1 | 2017-2025 9 | * Copyright Longitude One 2020-2025 10 | * Copyright 2015 Derek J. Lambert 11 | * 12 | * For the full copyright and license information, please view the LICENSE 13 | * file that was distributed with this source code. 14 | * 15 | */ 16 | 17 | declare(strict_types=1); 18 | 19 | namespace LongitudeOne\Spatial\DBAL\Types; 20 | 21 | use LongitudeOne\Spatial\DBAL\Platform\MariaDB; 22 | use LongitudeOne\Spatial\DBAL\Platform\MySql; 23 | use LongitudeOne\Spatial\DBAL\Platform\PlatformInterface; 24 | use LongitudeOne\Spatial\DBAL\Platform\PostgreSql; 25 | 26 | /** 27 | * Doctrine GEOMETRY type. 28 | * 29 | * @author Derek J. Lambert 30 | * @license https://dlambert.mit-license.org MIT 31 | */ 32 | class GeometryType extends AbstractSpatialType 33 | { 34 | /** 35 | * Return an array of all platform supporting the current type. 36 | * 37 | * @return class-string[] 38 | */ 39 | protected function getSupportedPlatforms(): array 40 | { 41 | return [ 42 | MariaDB::class, 43 | MySql::class, 44 | PostgreSql::class, 45 | ]; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /lib/LongitudeOne/Spatial/DBAL/Types/GeographyType.php: -------------------------------------------------------------------------------- 1 | 2017-2025 9 | * Copyright Longitude One 2020-2025 10 | * Copyright 2015 Derek J. Lambert 11 | * 12 | * For the full copyright and license information, please view the LICENSE 13 | * file that was distributed with this source code. 14 | * 15 | */ 16 | 17 | declare(strict_types=1); 18 | 19 | namespace LongitudeOne\Spatial\DBAL\Types; 20 | 21 | use LongitudeOne\Spatial\DBAL\Platform\MariaDB; 22 | use LongitudeOne\Spatial\DBAL\Platform\MySql; 23 | use LongitudeOne\Spatial\DBAL\Platform\PlatformInterface; 24 | use LongitudeOne\Spatial\DBAL\Platform\PostgreSql; 25 | 26 | /** 27 | * Doctrine GEOGRAPHY type. 28 | * 29 | * @author Derek J. Lambert 30 | * @license https://dlambert.mit-license.org MIT 31 | */ 32 | class GeographyType extends AbstractSpatialType 33 | { 34 | /** 35 | * Return an array of all platform supporting the current type. 36 | * 37 | * @return class-string[] 38 | */ 39 | protected function getSupportedPlatforms(): array 40 | { 41 | return [ 42 | MariaDB::class, 43 | MySql::class, 44 | PostgreSql::class, 45 | ]; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /lib/LongitudeOne/Spatial/PHP/Types/Geometry/Point.php: -------------------------------------------------------------------------------- 1 | 2017-2025 9 | * Copyright Longitude One 2020-2025 10 | * Copyright 2015 Derek J. Lambert 11 | * 12 | * For the full copyright and license information, please view the LICENSE 13 | * file that was distributed with this source code. 14 | * 15 | */ 16 | 17 | declare(strict_types=1); 18 | 19 | namespace LongitudeOne\Spatial\PHP\Types\Geometry; 20 | 21 | use LongitudeOne\Spatial\Exception\InvalidValueException; 22 | use LongitudeOne\Spatial\PHP\Types\AbstractPoint; 23 | use LongitudeOne\Spatial\PHP\Types\CartesianInterface; 24 | use LongitudeOne\Spatial\PHP\Types\PointInterface; 25 | 26 | /** 27 | * Point object for the POINT geometry type. 28 | */ 29 | class Point extends AbstractPoint implements CartesianInterface, GeometryInterface, PointInterface 30 | { 31 | /** 32 | * Point internal constructor. 33 | * 34 | * It uses X and Y setters. 35 | * 36 | * @param string $x X, longitude 37 | * @param string $y Y, latitude 38 | * @param null|int $srid Spatial Reference System Identifier 39 | * 40 | * @throws InvalidValueException if x or y are invalid 41 | */ 42 | protected function construct(string $x, string $y, ?int $srid = null): void 43 | { 44 | $this->setX($x) 45 | ->setY($y) 46 | ->setSrid($srid) 47 | ; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /lib/LongitudeOne/Spatial/PHP/Types/CartesianInterface.php: -------------------------------------------------------------------------------- 1 | 2017-2025 9 | * Copyright Longitude One 2020-2025 10 | * Copyright 2015 Derek J. Lambert 11 | * 12 | * For the full copyright and license information, please view the LICENSE 13 | * file that was distributed with this source code. 14 | * 15 | */ 16 | 17 | declare(strict_types=1); 18 | 19 | namespace LongitudeOne\Spatial\PHP\Types; 20 | 21 | /** 22 | * Cartesian coordinates are planar coordinates expressed in linear units (meters). 23 | * It includes projected coordinates, map projection coordinates, grid coordinates. 24 | * Coordinates are x and y. 25 | * 26 | * Be aware that the setters of this interface don't throw exceptions when coordinates are out of range of the selected SRID. 27 | */ 28 | interface CartesianInterface 29 | { 30 | /** 31 | * @return float|int the abscissa coordinate 32 | */ 33 | public function getX(): float|int; 34 | 35 | /** 36 | * @return float|int the ordinate coordinate 37 | */ 38 | public function getY(): float|int; 39 | 40 | /** 41 | * The interface doesn't fix the return type. 42 | * Usually, fluent setters return "self". 43 | * Cartesian interfaces are used in AbstractPoint. It can return a geometry interface or a geographic one. 44 | * 45 | * @param float|int|string $x the abscissa coordinate 46 | */ 47 | public function setX(float|int|string $x): CartesianInterface|PointInterface; 48 | 49 | /** 50 | * The interface doesn't fix the return type. 51 | * Usually, fluent setters return "self". 52 | * Cartesian interfaces are used in AbstractPoint. It can return a geometry interface or a geographic one. 53 | * 54 | * @param float|int|string $y the ordinate coordinate 55 | */ 56 | public function setY(float|int|string $y): CartesianInterface|PointInterface; 57 | } 58 | -------------------------------------------------------------------------------- /lib/LongitudeOne/Spatial/PHP/Types/GeodeticInterface.php: -------------------------------------------------------------------------------- 1 | 2017-2025 9 | * Copyright Longitude One 2020-2025 10 | * Copyright 2015 Derek J. Lambert 11 | * 12 | * For the full copyright and license information, please view the LICENSE 13 | * file that was distributed with this source code. 14 | * 15 | */ 16 | 17 | declare(strict_types=1); 18 | 19 | namespace LongitudeOne\Spatial\PHP\Types; 20 | 21 | use LongitudeOne\Spatial\Exception\InvalidValueException; 22 | 23 | /** 24 | * Geodetic (or geographic) coordinates are spherical coordinates expressed in angular units (degrees). 25 | * Coordinates are longitude and latitude. 26 | */ 27 | interface GeodeticInterface 28 | { 29 | /** 30 | * @return float|int the converted latitude coordinate 31 | */ 32 | public function getLatitude(): float|int; 33 | 34 | /** 35 | * @return float|int the converted longitude coordinate 36 | */ 37 | public function getLongitude(): float|int; 38 | 39 | /** 40 | * The interface doesn't fix the return type. 41 | * Usually, fluent setters return "self". 42 | * Geodetic interfaces are used in AbstractPoint. It can return a geometry interface or a geographic one. 43 | * 44 | * @param float|int|string $latitude latitude to set. Out of range values are not allowed. 45 | * 46 | * @throws InvalidValueException when latitude is out of range 47 | */ 48 | public function setLatitude(float|int|string $latitude): GeodeticInterface|PointInterface; 49 | 50 | /** 51 | * The interface doesn't fix the return type. 52 | * Usually, fluent setters return "self". 53 | * Geodetic interfaces are used in AbstractPoint. It can return a geometry interface or a geographic one. 54 | * 55 | * @param float|int|string $longitude longitude to set. Out of range values are not allowed. 56 | * 57 | * @throws InvalidValueException when longitude is out of range 58 | */ 59 | public function setLongitude(float|int|string $longitude): GeodeticInterface|PointInterface; 60 | } 61 | -------------------------------------------------------------------------------- /lib/LongitudeOne/Spatial/PHP/Types/SpatialInterface.php: -------------------------------------------------------------------------------- 1 | 2017-2025 9 | * Copyright Longitude One 2020-2025 10 | * Copyright 2015 Derek J. Lambert 11 | * 12 | * For the full copyright and license information, please view the LICENSE 13 | * file that was distributed with this source code. 14 | * 15 | */ 16 | 17 | declare(strict_types=1); 18 | 19 | namespace LongitudeOne\Spatial\PHP\Types; 20 | 21 | use Doctrine\DBAL\Types\Type; 22 | 23 | interface SpatialInterface 24 | { 25 | public const GEOGRAPHY = 'Geography'; 26 | public const GEOGRAPHYCOLLECTION = 'GeographyCollection'; 27 | public const GEOMETRY = 'Geometry'; 28 | public const GEOMETRYCOLLECTION = 'GeometryCollection'; 29 | public const LINESTRING = 'LineString'; 30 | public const MULTILINESTRING = 'MultiLineString'; 31 | public const MULTIPOINT = 'MultiPoint'; 32 | public const MULTIPOLYGON = 'MultiPolygon'; 33 | public const POINT = 'Point'; 34 | public const POLYGON = 'Polygon'; 35 | 36 | /** 37 | * Return the Spatial Reference Identifier (SRID) of this object. 38 | */ 39 | public function getSrid(): ?int; 40 | 41 | /** 42 | * Return the type of this geometry or geography. 43 | * This function is used by the spatial type to get the type of the object. 44 | */ 45 | public function getType(): string; 46 | 47 | /** 48 | * Set the Spatial Reference Identifier (SRID) of this object. 49 | * 50 | * @param ?int $srid the Spatial Reference Identifier (SRID) 51 | */ 52 | public function setSrid(?int $srid): self; 53 | 54 | /** 55 | * Convert any spatial object to its array representation. 56 | * 57 | * Array does NOT contain SpatialInterface, only floats, integers, and arrays. 58 | * 59 | * @return (float|int)[]|(float|int)[][]|(float|int)[][][]|(float|int)[][][][] 60 | */ 61 | public function toArray(): array; 62 | 63 | /** 64 | * Convert any spatial object to its string representation. 65 | * Example: 'POINT(42 42)'. 66 | */ 67 | public function __toString(): string; 68 | } 69 | -------------------------------------------------------------------------------- /lib/LongitudeOne/Spatial/PHP/Types/Geography/Point.php: -------------------------------------------------------------------------------- 1 | 2017-2025 9 | * Copyright Longitude One 2020-2025 10 | * Copyright 2015 Derek J. Lambert 11 | * 12 | * For the full copyright and license information, please view the LICENSE 13 | * file that was distributed with this source code. 14 | * 15 | */ 16 | 17 | declare(strict_types=1); 18 | 19 | namespace LongitudeOne\Spatial\PHP\Types\Geography; 20 | 21 | use LongitudeOne\Spatial\Exception\InvalidValueException; 22 | use LongitudeOne\Spatial\PHP\Types\AbstractPoint; 23 | use LongitudeOne\Spatial\PHP\Types\GeodeticInterface; 24 | use LongitudeOne\Spatial\PHP\Types\PointInterface; 25 | 26 | /** 27 | * Point object for the POINT geography type. 28 | */ 29 | class Point extends AbstractPoint implements GeodeticInterface, GeographyInterface, PointInterface 30 | { 31 | /** 32 | * X setter. 33 | * 34 | * @param float|int|string $x X coordinate 35 | * 36 | * @throws InvalidValueException when y is not in range of accepted value, or is totally invalid 37 | */ 38 | public function setX(float|int|string $x): static 39 | { 40 | // TODO #67 - Trigger a deprecation notice when using this method. Advice to use setLongitude instead. 41 | return parent::setLongitude($x); 42 | } 43 | 44 | /** 45 | * Y setter. 46 | * 47 | * @param float|int|string $y the Y coordinate 48 | * 49 | * @throws InvalidValueException when y is not in range of accepted value, or is totally invalid 50 | */ 51 | public function setY(float|int|string $y): static 52 | { 53 | // TODO #67 - Trigger a deprecation notice when using this method. Advice to use setLongitude instead. 54 | return parent::setLatitude($y); 55 | } 56 | 57 | /** 58 | * Point internal constructor. 59 | * 60 | * It uses Longitude and Latitude setters. 61 | * 62 | * @param string $x X, longitude 63 | * @param string $y Y, latitude 64 | * @param null|int $srid Spatial Reference System Identifier 65 | * 66 | * @throws InvalidValueException if x or y are invalid 67 | */ 68 | protected function construct(string $x, string $y, ?int $srid = null): void 69 | { 70 | $this->setLongitude($x) 71 | ->setLatitude($y) 72 | ->setSrid($srid) 73 | ; 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /lib/LongitudeOne/Spatial/ORM/Query/AST/Functions/MySql/SpMbrContains.php: -------------------------------------------------------------------------------- 1 | 2017-2025 9 | * Copyright Longitude One 2020-2025 10 | * Copyright 2015 Derek J. Lambert 11 | * 12 | * For the full copyright and license information, please view the LICENSE 13 | * file that was distributed with this source code. 14 | * 15 | */ 16 | 17 | declare(strict_types=1); 18 | 19 | namespace LongitudeOne\Spatial\ORM\Query\AST\Functions\MySql; 20 | 21 | use Doctrine\DBAL\Platforms\AbstractPlatform; 22 | use Doctrine\DBAL\Platforms\MySQLPlatform; 23 | use LongitudeOne\Spatial\ORM\Query\AST\Functions\AbstractSpatialDQLFunction; 24 | 25 | /** 26 | * Sp_MBRContains DQL function. 27 | * 28 | * @author Alexandre Tranchant 29 | * @license https://alexandre-tranchant.mit-license.org 30 | */ 31 | class SpMbrContains extends AbstractSpatialDQLFunction 32 | { 33 | /** 34 | * Function SQL name getter. 35 | * 36 | * @since 2.0 This function replace the protected property functionName. 37 | */ 38 | protected function getFunctionName(): string 39 | { 40 | return 'MBRContains'; 41 | } 42 | 43 | /** 44 | * Maximum number of parameters for the spatial function. 45 | * 46 | * @since 2.0 This function replace the protected property maxGeomExpr. 47 | * 48 | * @return int the inherited methods shall NOT return null, but 0 when function has no parameter 49 | */ 50 | protected function getMaxParameter(): int 51 | { 52 | return 2; 53 | } 54 | 55 | /** 56 | * Minimum number of parameters for the spatial function. 57 | * 58 | * @since 2.0 This function replace the protected property minGeomExpr. 59 | * 60 | * @return int the inherited methods shall NOT return null, but 0 when function has no parameter 61 | */ 62 | protected function getMinParameter(): int 63 | { 64 | return 2; 65 | } 66 | 67 | /** 68 | * Get the platforms accepted. 69 | * 70 | * @since 2.0 This function replace the protected property platforms. 71 | * @since 5.0 This function returns the class-string[] instead of string[] 72 | * 73 | * @return class-string[] a non-empty array of accepted platforms 74 | */ 75 | protected function getPlatforms(): array 76 | { 77 | return [MySQLPlatform::class]; 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /lib/LongitudeOne/Spatial/ORM/Query/AST/Functions/MySql/SpMbrDisjoint.php: -------------------------------------------------------------------------------- 1 | 2017-2025 9 | * Copyright Longitude One 2020-2025 10 | * Copyright 2015 Derek J. Lambert 11 | * 12 | * For the full copyright and license information, please view the LICENSE 13 | * file that was distributed with this source code. 14 | * 15 | */ 16 | 17 | declare(strict_types=1); 18 | 19 | namespace LongitudeOne\Spatial\ORM\Query\AST\Functions\MySql; 20 | 21 | use Doctrine\DBAL\Platforms\AbstractPlatform; 22 | use Doctrine\DBAL\Platforms\MySQLPlatform; 23 | use LongitudeOne\Spatial\ORM\Query\AST\Functions\AbstractSpatialDQLFunction; 24 | 25 | /** 26 | * MBRDisjoint DQL function. 27 | * 28 | * @author Alexandre Tranchant 29 | * @license https://alexandre-tranchant.mit-license.org 30 | */ 31 | class SpMbrDisjoint extends AbstractSpatialDQLFunction 32 | { 33 | /** 34 | * Function SQL name getter. 35 | * 36 | * @since 2.0 This function replace the protected property functionName. 37 | */ 38 | protected function getFunctionName(): string 39 | { 40 | return 'MBRDisjoint'; 41 | } 42 | 43 | /** 44 | * Maximum number of parameters for the spatial function. 45 | * 46 | * @since 2.0 This function replace the protected property maxGeomExpr. 47 | * 48 | * @return int the inherited methods shall NOT return null, but 0 when function has no parameter 49 | */ 50 | protected function getMaxParameter(): int 51 | { 52 | return 2; 53 | } 54 | 55 | /** 56 | * Minimum number of parameters for the spatial function. 57 | * 58 | * @since 2.0 This function replace the protected property minGeomExpr. 59 | * 60 | * @return int the inherited methods shall NOT return null, but 0 when function has no parameter 61 | */ 62 | protected function getMinParameter(): int 63 | { 64 | return 2; 65 | } 66 | 67 | /** 68 | * Get the platforms accepted. 69 | * 70 | * @since 2.0 This function replace the protected property platforms. 71 | * @since 5.0 This function returns the class-string[] instead of string[] 72 | * 73 | * @return class-string[] a non-empty array of accepted platforms 74 | */ 75 | protected function getPlatforms(): array 76 | { 77 | return [MySQLPlatform::class]; 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /lib/LongitudeOne/Spatial/ORM/Query/AST/Functions/Standard/StBuffer.php: -------------------------------------------------------------------------------- 1 | 2017-2025 9 | * Copyright Longitude One 2020-2025 10 | * Copyright 2015 Derek J. Lambert 11 | * 12 | * For the full copyright and license information, please view the LICENSE 13 | * file that was distributed with this source code. 14 | * 15 | */ 16 | 17 | declare(strict_types=1); 18 | 19 | namespace LongitudeOne\Spatial\ORM\Query\AST\Functions\Standard; 20 | 21 | use Doctrine\DBAL\Platforms\AbstractPlatform; 22 | use Doctrine\DBAL\Platforms\PostgreSQLPlatform; 23 | use LongitudeOne\Spatial\ORM\Query\AST\Functions\AbstractSpatialDQLFunction; 24 | 25 | /** 26 | * ST_Buffer DQL function. 27 | * 28 | * @author Alexandre Tranchant 29 | * @license https://alexandre-tranchant.mit-license.org 30 | */ 31 | class StBuffer extends AbstractSpatialDQLFunction 32 | { 33 | /** 34 | * Function SQL name getter. 35 | * 36 | * @since 2.0 This function replace the protected property functionName. 37 | */ 38 | protected function getFunctionName(): string 39 | { 40 | return 'ST_Buffer'; 41 | } 42 | 43 | /** 44 | * Maximum number of parameters for the spatial function. 45 | * 46 | * @since 2.0 This function replace the protected property maxGeomExpr. 47 | * 48 | * @return int the inherited methods shall NOT return null, but 0 when function has no parameter 49 | */ 50 | protected function getMaxParameter(): int 51 | { 52 | return 3; 53 | } 54 | 55 | /** 56 | * Minimum number of parameter for the spatial function. 57 | * 58 | * @since 2.0 This function replace the protected property minGeomExpr. 59 | * 60 | * @return int the inherited methods shall NOT return null, but 0 when function has no parameter 61 | */ 62 | protected function getMinParameter(): int 63 | { 64 | return 2; 65 | } 66 | 67 | /** 68 | * Get the platforms accepted. 69 | * 70 | * @since 2.0 This function replace the protected property platforms. 71 | * @since 5.0 This function returns the class-string[] instead of string[] 72 | * 73 | * @return class-string[] a non-empty array of accepted platforms 74 | */ 75 | protected function getPlatforms(): array 76 | { 77 | return [PostgreSQLPlatform::class]; 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /lib/LongitudeOne/Spatial/ORM/Query/AST/Functions/MariaDB/SpMbrDisjoint.php: -------------------------------------------------------------------------------- 1 | 2017-2025 9 | * Copyright Longitude One 2020-2025 10 | * Copyright 2015 Derek J. Lambert 11 | * 12 | * For the full copyright and license information, please view the LICENSE 13 | * file that was distributed with this source code. 14 | * 15 | */ 16 | 17 | declare(strict_types=1); 18 | 19 | namespace LongitudeOne\Spatial\ORM\Query\AST\Functions\MariaDB; 20 | 21 | use Doctrine\DBAL\Platforms\AbstractPlatform; 22 | use Doctrine\DBAL\Platforms\MariaDBPlatform; 23 | use LongitudeOne\Spatial\ORM\Query\AST\Functions\AbstractSpatialDQLFunction; 24 | 25 | /** 26 | * MBRDisjoint DQL function. 27 | * 28 | * @author Alexandre Tranchant 29 | * @license https://alexandre-tranchant.mit-license.org 30 | */ 31 | class SpMbrDisjoint extends AbstractSpatialDQLFunction 32 | { 33 | /** 34 | * Function SQL name getter. 35 | * 36 | * @since 2.0 This function replace the protected property functionName. 37 | */ 38 | protected function getFunctionName(): string 39 | { 40 | return 'MBRDisjoint'; 41 | } 42 | 43 | /** 44 | * Maximum number of parameters for the spatial function. 45 | * 46 | * @since 2.0 This function replace the protected property maxGeomExpr. 47 | * 48 | * @return int the inherited methods shall NOT return null, but 0 when function has no parameter 49 | */ 50 | protected function getMaxParameter(): int 51 | { 52 | return 2; 53 | } 54 | 55 | /** 56 | * Minimum number of parameters for the spatial function. 57 | * 58 | * @since 2.0 This function replace the protected property minGeomExpr. 59 | * 60 | * @return int the inherited methods shall NOT return null, but 0 when function has no parameter 61 | */ 62 | protected function getMinParameter(): int 63 | { 64 | return 2; 65 | } 66 | 67 | /** 68 | * Get the platforms accepted. 69 | * 70 | * @since 2.0 This function replace the protected property platforms. 71 | * @since 5.0 This function returns the class-string[] instead of string[] 72 | * 73 | * @return class-string[] a non-empty array of accepted platforms 74 | */ 75 | protected function getPlatforms(): array 76 | { 77 | return [MariaDBPlatform::class]; 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /lib/LongitudeOne/Spatial/ORM/Query/AST/Functions/MySql/SpGeometryType.php: -------------------------------------------------------------------------------- 1 | 2017-2025 9 | * Copyright Longitude One 2020-2025 10 | * Copyright 2015 Derek J. Lambert 11 | * 12 | * For the full copyright and license information, please view the LICENSE 13 | * file that was distributed with this source code. 14 | * 15 | */ 16 | 17 | declare(strict_types=1); 18 | 19 | namespace LongitudeOne\Spatial\ORM\Query\AST\Functions\MySql; 20 | 21 | use Doctrine\DBAL\Platforms\AbstractPlatform; 22 | use Doctrine\DBAL\Platforms\MySQLPlatform; 23 | use LongitudeOne\Spatial\ORM\Query\AST\Functions\AbstractSpatialDQLFunction; 24 | 25 | /** 26 | * Geometry DQL function. 27 | * 28 | * @author Alexandre Tranchant 29 | * @license https://alexandre-tranchant.mit-license.org MIT 30 | */ 31 | class SpGeometryType extends AbstractSpatialDQLFunction 32 | { 33 | /** 34 | * Function SQL name getter. 35 | * 36 | * @since 2.0 This function replace the protected property functionName. 37 | */ 38 | protected function getFunctionName(): string 39 | { 40 | return 'ST_GeometryType'; 41 | } 42 | 43 | /** 44 | * Maximum number of parameters for the spatial function. 45 | * 46 | * @since 2.0 This function replace the protected property maxGeomExpr. 47 | * 48 | * @return int the inherited methods shall NOT return null, but 0 when function has no parameter 49 | */ 50 | protected function getMaxParameter(): int 51 | { 52 | return 1; 53 | } 54 | 55 | /** 56 | * Minimum number of parameters for the spatial function. 57 | * 58 | * @since 2.0 This function replace the protected property minGeomExpr. 59 | * 60 | * @return int the inherited methods shall NOT return null, but 0 when function has no parameter 61 | */ 62 | protected function getMinParameter(): int 63 | { 64 | return 1; 65 | } 66 | 67 | /** 68 | * Get the platforms accepted. 69 | * 70 | * @since 2.0 This function replace the protected property platforms. 71 | * @since 5.0 This function returns the class-string[] instead of string[] 72 | * 73 | * @return class-string[] a non-empty array of accepted platforms 74 | */ 75 | protected function getPlatforms(): array 76 | { 77 | return [MySQLPlatform::class]; 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /lib/LongitudeOne/Spatial/ORM/Query/AST/Functions/MariaDB/SpMbrContains.php: -------------------------------------------------------------------------------- 1 | 2017-2025 9 | * Copyright Longitude One 2020-2025 10 | * Copyright 2015 Derek J. Lambert 11 | * 12 | * For the full copyright and license information, please view the LICENSE 13 | * file that was distributed with this source code. 14 | * 15 | */ 16 | 17 | declare(strict_types=1); 18 | 19 | namespace LongitudeOne\Spatial\ORM\Query\AST\Functions\MariaDB; 20 | 21 | use Doctrine\DBAL\Platforms\AbstractPlatform; 22 | use Doctrine\DBAL\Platforms\MariaDBPlatform; 23 | use LongitudeOne\Spatial\ORM\Query\AST\Functions\AbstractSpatialDQLFunction; 24 | 25 | /** 26 | * Sp_MBRContains DQL function. 27 | * 28 | * @author Alexandre Tranchant 29 | * @license https://alexandre-tranchant.mit-license.org 30 | */ 31 | class SpMbrContains extends AbstractSpatialDQLFunction 32 | { 33 | /** 34 | * Function SQL name getter. 35 | * 36 | * @since 2.0 This function replace the protected property functionName. 37 | */ 38 | protected function getFunctionName(): string 39 | { 40 | return 'MBRContains'; 41 | } 42 | 43 | /** 44 | * Maximum number of parameters for the spatial function. 45 | * 46 | * @since 2.0 This function replace the protected property maxGeomExpr. 47 | * 48 | * @return int the inherited methods shall NOT return null, but 0 when function has no parameter 49 | */ 50 | protected function getMaxParameter(): int 51 | { 52 | return 2; 53 | } 54 | 55 | /** 56 | * Minimum number of parameters for the spatial function. 57 | * 58 | * @since 2.0 This function replace the protected property minGeomExpr. 59 | * 60 | * @return int the inherited methods shall NOT return null, but 0 when function has no parameter 61 | */ 62 | protected function getMinParameter(): int 63 | { 64 | return 2; 65 | } 66 | 67 | /** 68 | * Get the platforms accepted. 69 | * 70 | * @since 2.0 This function replace the protected property platforms. 71 | * @since 5.0 This function returns the class-string[] instead of string[] 72 | * 73 | * @return class-string[] a non-empty array of accepted platforms 74 | */ 75 | protected function getPlatforms(): array 76 | { 77 | return [MariaDBPlatform::class]; 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /lib/LongitudeOne/Spatial/ORM/Query/AST/Functions/PostgreSql/SpSimplify.php: -------------------------------------------------------------------------------- 1 | 2017-2025 9 | * Copyright Longitude One 2020-2025 10 | * Copyright 2015 Derek J. Lambert 11 | * 12 | * For the full copyright and license information, please view the LICENSE 13 | * file that was distributed with this source code. 14 | * 15 | */ 16 | 17 | declare(strict_types=1); 18 | 19 | namespace LongitudeOne\Spatial\ORM\Query\AST\Functions\PostgreSql; 20 | 21 | use Doctrine\DBAL\Platforms\AbstractPlatform; 22 | use Doctrine\DBAL\Platforms\PostgreSQLPlatform; 23 | use LongitudeOne\Spatial\ORM\Query\AST\Functions\AbstractSpatialDQLFunction; 24 | 25 | /** 26 | * ST_Simplify DQL function. 27 | * 28 | * @author Alexandre Tranchant 29 | * @license https://alexandre-tranchant.mit-license.org 30 | */ 31 | class SpSimplify extends AbstractSpatialDQLFunction 32 | { 33 | /** 34 | * Function SQL name getter. 35 | * 36 | * @since 2.0 This function replace the protected property functionName. 37 | */ 38 | protected function getFunctionName(): string 39 | { 40 | return 'ST_Simplify'; 41 | } 42 | 43 | /** 44 | * Maximum number of parameter for the spatial function. 45 | * 46 | * @since 2.0 This function replace the protected property maxGeomExpr. 47 | * 48 | * @return int the inherited methods shall NOT return null, but 0 when function has no parameter 49 | */ 50 | protected function getMaxParameter(): int 51 | { 52 | return 2; 53 | } 54 | 55 | /** 56 | * Minimum number of parameter for the spatial function. 57 | * 58 | * @since 2.0 This function replace the protected property minGeomExpr. 59 | * 60 | * @return int the inherited methods shall NOT return null, but 0 when function has no parameter 61 | */ 62 | protected function getMinParameter(): int 63 | { 64 | return 2; 65 | } 66 | 67 | /** 68 | * Get the platforms accepted. 69 | * 70 | * @since 2.0 This function replace the protected property platforms. 71 | * @since 5.0 This function returns the class-string[] instead of string[] 72 | * 73 | * @return class-string[] a non-empty array of accepted platforms 74 | */ 75 | protected function getPlatforms(): array 76 | { 77 | return [PostgreSQLPlatform::class]; 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /lib/LongitudeOne/Spatial/ORM/Query/AST/Functions/MariaDB/SpGeometryType.php: -------------------------------------------------------------------------------- 1 | 2017-2025 9 | * Copyright Longitude One 2020-2025 10 | * Copyright 2015 Derek J. Lambert 11 | * 12 | * For the full copyright and license information, please view the LICENSE 13 | * file that was distributed with this source code. 14 | * 15 | */ 16 | 17 | declare(strict_types=1); 18 | 19 | namespace LongitudeOne\Spatial\ORM\Query\AST\Functions\MariaDB; 20 | 21 | use Doctrine\DBAL\Platforms\AbstractPlatform; 22 | use Doctrine\DBAL\Platforms\MariaDBPlatform; 23 | use LongitudeOne\Spatial\ORM\Query\AST\Functions\AbstractSpatialDQLFunction; 24 | 25 | /** 26 | * Geometry DQL function. 27 | * 28 | * @author Alexandre Tranchant 29 | * @license https://alexandre-tranchant.mit-license.org MIT 30 | */ 31 | class SpGeometryType extends AbstractSpatialDQLFunction 32 | { 33 | /** 34 | * Function SQL name getter. 35 | * 36 | * @since 2.0 This function replace the protected property functionName. 37 | */ 38 | protected function getFunctionName(): string 39 | { 40 | return 'ST_GeometryType'; 41 | } 42 | 43 | /** 44 | * Maximum number of parameters for the spatial function. 45 | * 46 | * @since 2.0 This function replace the protected property maxGeomExpr. 47 | * 48 | * @return int the inherited methods shall NOT return null, but 0 when function has no parameter 49 | */ 50 | protected function getMaxParameter(): int 51 | { 52 | return 1; 53 | } 54 | 55 | /** 56 | * Minimum number of parameters for the spatial function. 57 | * 58 | * @since 2.0 This function replace the protected property minGeomExpr. 59 | * 60 | * @return int the inherited methods shall NOT return null, but 0 when function has no parameter 61 | */ 62 | protected function getMinParameter(): int 63 | { 64 | return 1; 65 | } 66 | 67 | /** 68 | * Get the platforms accepted. 69 | * 70 | * @since 2.0 This function replace the protected property platforms. 71 | * @since 5.0 This function returns the class-string[] instead of string[] 72 | * 73 | * @return class-string[] a non-empty array of accepted platforms 74 | */ 75 | protected function getPlatforms(): array 76 | { 77 | return [MariaDBPlatform::class]; 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /lib/LongitudeOne/Spatial/ORM/Query/AST/Functions/PostgreSql/SpGeometryType.php: -------------------------------------------------------------------------------- 1 | 2017-2025 9 | * Copyright Longitude One 2020-2025 10 | * Copyright 2015 Derek J. Lambert 11 | * 12 | * For the full copyright and license information, please view the LICENSE 13 | * file that was distributed with this source code. 14 | * 15 | */ 16 | 17 | declare(strict_types=1); 18 | 19 | namespace LongitudeOne\Spatial\ORM\Query\AST\Functions\PostgreSql; 20 | 21 | use Doctrine\DBAL\Platforms\AbstractPlatform; 22 | use Doctrine\DBAL\Platforms\PostgreSQLPlatform; 23 | use LongitudeOne\Spatial\ORM\Query\AST\Functions\AbstractSpatialDQLFunction; 24 | 25 | /** 26 | * Geometry DQL function. 27 | * 28 | * @author Alexandre Tranchant 29 | * @license https://alexandre-tranchant.mit-license.org MIT 30 | */ 31 | class SpGeometryType extends AbstractSpatialDQLFunction 32 | { 33 | /** 34 | * Function SQL name getter. 35 | * 36 | * @since 2.0 This function replace the protected property functionName. 37 | */ 38 | protected function getFunctionName(): string 39 | { 40 | return 'GeometryType'; 41 | } 42 | 43 | /** 44 | * Maximum number of parameter for the spatial function. 45 | * 46 | * @since 2.0 This function replace the protected property maxGeomExpr. 47 | * 48 | * @return int the inherited methods shall NOT return null, but 0 when function has no parameter 49 | */ 50 | protected function getMaxParameter(): int 51 | { 52 | return 1; 53 | } 54 | 55 | /** 56 | * Minimum number of parameter for the spatial function. 57 | * 58 | * @since 2.0 This function replace the protected property minGeomExpr. 59 | * 60 | * @return int the inherited methods shall NOT return null, but 0 when function has no parameter 61 | */ 62 | protected function getMinParameter(): int 63 | { 64 | return 1; 65 | } 66 | 67 | /** 68 | * Get the platforms accepted. 69 | * 70 | * @since 2.0 This function replace the protected property platforms. 71 | * @since 5.0 This function returns the class-string[] instead of string[] 72 | * 73 | * @return class-string[] a non-empty array of accepted platforms 74 | */ 75 | protected function getPlatforms(): array 76 | { 77 | return [PostgreSQLPlatform::class]; 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /lib/LongitudeOne/Spatial/ORM/Query/AST/Functions/MySql/SpMbrOverlaps.php: -------------------------------------------------------------------------------- 1 | 2017-2025 9 | * Copyright Longitude One 2020-2025 10 | * Copyright 2015 Derek J. Lambert 11 | * 12 | * For the full copyright and license information, please view the LICENSE 13 | * file that was distributed with this source code. 14 | * 15 | */ 16 | 17 | declare(strict_types=1); 18 | 19 | namespace LongitudeOne\Spatial\ORM\Query\AST\Functions\MySql; 20 | 21 | use Doctrine\DBAL\Platforms\AbstractPlatform; 22 | use Doctrine\DBAL\Platforms\MySQLPlatform; 23 | use LongitudeOne\Spatial\ORM\Query\AST\Functions\AbstractSpatialDQLFunction; 24 | 25 | /** 26 | * ST_Overlaps DQL function. 27 | * 28 | * @author Dragos Protung 29 | * @author Alexandre Tranchant 30 | * @license https://alexandre-tranchant.mit-license.org 31 | */ 32 | class SpMbrOverlaps extends AbstractSpatialDQLFunction 33 | { 34 | /** 35 | * Function SQL name getter. 36 | * 37 | * @since 2.0 This function replace the protected property functionName. 38 | */ 39 | protected function getFunctionName(): string 40 | { 41 | return 'ST_Overlaps'; 42 | } 43 | 44 | /** 45 | * Maximum number of parameters for the spatial function. 46 | * 47 | * @since 2.0 This function replace the protected property maxGeomExpr. 48 | * 49 | * @return int the inherited methods shall NOT return null, but 0 when function has no parameter 50 | */ 51 | protected function getMaxParameter(): int 52 | { 53 | return 2; 54 | } 55 | 56 | /** 57 | * Minimum number of parameters for the spatial function. 58 | * 59 | * @since 2.0 This function replace the protected property minGeomExpr. 60 | * 61 | * @return int the inherited methods shall NOT return null, but 0 when function has no parameter 62 | */ 63 | protected function getMinParameter(): int 64 | { 65 | return 2; 66 | } 67 | 68 | /** 69 | * Get the platforms accepted. 70 | * 71 | * @since 2.0 This function replace the protected property platforms. 72 | * @since 5.0 This function returns the class-string[] instead of string[] 73 | * 74 | * @return class-string[] a non-empty array of accepted platforms 75 | */ 76 | protected function getPlatforms(): array 77 | { 78 | return [MySQLPlatform::class]; 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /lib/LongitudeOne/Spatial/ORM/Query/AST/Functions/PostgreSql/SpDWithin.php: -------------------------------------------------------------------------------- 1 | 2017-2025 9 | * Copyright Longitude One 2020-2025 10 | * Copyright 2015 Derek J. Lambert 11 | * 12 | * For the full copyright and license information, please view the LICENSE 13 | * file that was distributed with this source code. 14 | * 15 | */ 16 | 17 | declare(strict_types=1); 18 | 19 | namespace LongitudeOne\Spatial\ORM\Query\AST\Functions\PostgreSql; 20 | 21 | use Doctrine\DBAL\Platforms\AbstractPlatform; 22 | use Doctrine\DBAL\Platforms\PostgreSQLPlatform; 23 | use LongitudeOne\Spatial\ORM\Query\AST\Functions\AbstractSpatialDQLFunction; 24 | 25 | /** 26 | * ST_DWithin DQL function. 27 | * 28 | * @author David Pacheco 29 | * @author Alexandre Tranchant 30 | * @license https://dlambert.mit-license.org MIT 31 | */ 32 | class SpDWithin extends AbstractSpatialDQLFunction 33 | { 34 | /** 35 | * Function SQL name getter. 36 | * 37 | * @since 2.0 This function replace the protected property functionName. 38 | */ 39 | protected function getFunctionName(): string 40 | { 41 | return 'ST_DWithin'; 42 | } 43 | 44 | /** 45 | * Maximum number of parameter for the spatial function. 46 | * 47 | * @since 2.0 This function replace the protected property maxGeomExpr. 48 | * 49 | * @return int the inherited methods shall NOT return null, but 0 when function has no parameter 50 | */ 51 | protected function getMaxParameter(): int 52 | { 53 | return 4; 54 | } 55 | 56 | /** 57 | * Minimum number of parameter for the spatial function. 58 | * 59 | * @since 2.0 This function replace the protected property minGeomExpr. 60 | * 61 | * @return int the inherited methods shall NOT return null, but 0 when function has no parameter 62 | */ 63 | protected function getMinParameter(): int 64 | { 65 | return 2; 66 | } 67 | 68 | /** 69 | * Get the platforms accepted. 70 | * 71 | * @since 2.0 This function replace the protected property platforms. 72 | * @since 5.0 This function returns the class-string[] instead of string[] 73 | * 74 | * @return class-string[] a non-empty array of accepted platforms 75 | */ 76 | protected function getPlatforms(): array 77 | { 78 | return [PostgreSQLPlatform::class]; 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /lib/LongitudeOne/Spatial/ORM/Query/AST/Functions/Standard/StGeometryType.php: -------------------------------------------------------------------------------- 1 | 2017-2025 9 | * Copyright Longitude One 2020-2025 10 | * Copyright 2015 Derek J. Lambert 11 | * 12 | * For the full copyright and license information, please view the LICENSE 13 | * file that was distributed with this source code. 14 | * 15 | */ 16 | 17 | declare(strict_types=1); 18 | 19 | namespace LongitudeOne\Spatial\ORM\Query\AST\Functions\Standard; 20 | 21 | use Doctrine\DBAL\Platforms\AbstractPlatform; 22 | use Doctrine\DBAL\Platforms\PostgreSQLPlatform; 23 | use LongitudeOne\Spatial\ORM\Query\AST\Functions\AbstractSpatialDQLFunction; 24 | 25 | /** 26 | * ST_GeometryType DQL function. 27 | * 28 | * @author Alexandre Tranchant 29 | * @license https://alexandre-tranchant.mit-license.org MIT 30 | */ 31 | class StGeometryType extends AbstractSpatialDQLFunction 32 | { 33 | /** 34 | * Function SQL name getter. 35 | * 36 | * @since 2.0 This function replace the protected property functionName. 37 | */ 38 | protected function getFunctionName(): string 39 | { 40 | return 'ST_GeometryType'; 41 | } 42 | 43 | /** 44 | * Maximum number of parameters for the spatial function. 45 | * 46 | * @since 2.0 This function replace the protected property maxGeomExpr. 47 | * 48 | * @return int the inherited methods shall NOT return null, but 0 when function has no parameter 49 | */ 50 | protected function getMaxParameter(): int 51 | { 52 | return 1; 53 | } 54 | 55 | /** 56 | * Minimum number of parameters for the spatial function. 57 | * 58 | * @since 2.0 This function replace the protected property minGeomExpr. 59 | * 60 | * @return int the inherited methods shall NOT return null, but 0 when function has no parameter 61 | */ 62 | protected function getMinParameter(): int 63 | { 64 | return 1; 65 | } 66 | 67 | /** 68 | * Get the platforms accepted. 69 | * 70 | * @since 2.0 This function replace the protected property platforms. 71 | * @since 5.0 This function returns the class-string[] instead of string[] 72 | * 73 | * @return class-string[] a non-empty array of accepted platforms 74 | */ 75 | protected function getPlatforms(): array 76 | { 77 | return [PostgreSQLPlatform::class]; 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /lib/LongitudeOne/Spatial/ORM/Query/AST/Functions/MySql/SpMbrEquals.php: -------------------------------------------------------------------------------- 1 | 2017-2025 9 | * Copyright Longitude One 2020-2025 10 | * Copyright 2015 Derek J. Lambert 11 | * 12 | * For the full copyright and license information, please view the LICENSE 13 | * file that was distributed with this source code. 14 | * 15 | */ 16 | 17 | declare(strict_types=1); 18 | 19 | namespace LongitudeOne\Spatial\ORM\Query\AST\Functions\MySql; 20 | 21 | use Doctrine\DBAL\Platforms\AbstractPlatform; 22 | use Doctrine\DBAL\Platforms\MySQLPlatform; 23 | use LongitudeOne\Spatial\ORM\Query\AST\Functions\AbstractSpatialDQLFunction; 24 | 25 | /** 26 | * MBREquals DQL function. 27 | * 28 | * @author luca capra 29 | * @author Alexandre Tranchant 30 | * @license https://dlambert.mit-license.org MIT 31 | */ 32 | class SpMbrEquals extends AbstractSpatialDQLFunction 33 | { 34 | /** 35 | * Function SQL name getter. 36 | * 37 | * @since 2.0 This function replace the protected property functionName. 38 | */ 39 | protected function getFunctionName(): string 40 | { 41 | return 'MBREquals'; 42 | } 43 | 44 | /** 45 | * Maximum number of parameters for the spatial function. 46 | * 47 | * @since 2.0 This function replace the protected property maxGeomExpr. 48 | * 49 | * @return int the inherited methods shall NOT return null, but 0 when function has no parameter 50 | */ 51 | protected function getMaxParameter(): int 52 | { 53 | return 2; 54 | } 55 | 56 | /** 57 | * Minimum number of parameters for the spatial function. 58 | * 59 | * @since 2.0 This function replace the protected property minGeomExpr. 60 | * 61 | * @return int the inherited methods shall NOT return null, but 0 when function has no parameter 62 | */ 63 | protected function getMinParameter(): int 64 | { 65 | return 2; 66 | } 67 | 68 | /** 69 | * Get the platforms accepted. 70 | * 71 | * @since 2.0 This function replace the protected property platforms. 72 | * @since 5.0 This function returns the class-string[] instead of string[] 73 | * 74 | * @return class-string[] a non-empty array of accepted platforms 75 | */ 76 | protected function getPlatforms(): array 77 | { 78 | return [MySQLPlatform::class]; 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /lib/LongitudeOne/Spatial/ORM/Query/AST/Functions/MariaDB/SpMbrEquals.php: -------------------------------------------------------------------------------- 1 | 2017-2025 9 | * Copyright Longitude One 2020-2025 10 | * Copyright 2015 Derek J. Lambert 11 | * 12 | * For the full copyright and license information, please view the LICENSE 13 | * file that was distributed with this source code. 14 | * 15 | */ 16 | 17 | declare(strict_types=1); 18 | 19 | namespace LongitudeOne\Spatial\ORM\Query\AST\Functions\MariaDB; 20 | 21 | use Doctrine\DBAL\Platforms\AbstractPlatform; 22 | use Doctrine\DBAL\Platforms\MariaDBPlatform; 23 | use LongitudeOne\Spatial\ORM\Query\AST\Functions\AbstractSpatialDQLFunction; 24 | 25 | /** 26 | * MBREquals DQL function. 27 | * 28 | * @author luca capra 29 | * @author Alexandre Tranchant 30 | * @license https://dlambert.mit-license.org MIT 31 | */ 32 | class SpMbrEquals extends AbstractSpatialDQLFunction 33 | { 34 | /** 35 | * Function SQL name getter. 36 | * 37 | * @since 2.0 This function replace the protected property functionName. 38 | */ 39 | protected function getFunctionName(): string 40 | { 41 | return 'MBREquals'; 42 | } 43 | 44 | /** 45 | * Maximum number of parameters for the spatial function. 46 | * 47 | * @since 2.0 This function replace the protected property maxGeomExpr. 48 | * 49 | * @return int the inherited methods shall NOT return null, but 0 when function has no parameter 50 | */ 51 | protected function getMaxParameter(): int 52 | { 53 | return 2; 54 | } 55 | 56 | /** 57 | * Minimum number of parameters for the spatial function. 58 | * 59 | * @since 2.0 This function replace the protected property minGeomExpr. 60 | * 61 | * @return int the inherited methods shall NOT return null, but 0 when function has no parameter 62 | */ 63 | protected function getMinParameter(): int 64 | { 65 | return 2; 66 | } 67 | 68 | /** 69 | * Get the platforms accepted. 70 | * 71 | * @since 2.0 This function replace the protected property platforms. 72 | * @since 5.0 This function returns the class-string[] instead of string[] 73 | * 74 | * @return class-string[] a non-empty array of accepted platforms 75 | */ 76 | protected function getPlatforms(): array 77 | { 78 | return [MariaDBPlatform::class]; 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /lib/LongitudeOne/Spatial/ORM/Query/AST/Functions/MariaDB/SpMbrOverlaps.php: -------------------------------------------------------------------------------- 1 | 2017-2025 9 | * Copyright Longitude One 2020-2025 10 | * Copyright 2015 Derek J. Lambert 11 | * 12 | * For the full copyright and license information, please view the LICENSE 13 | * file that was distributed with this source code. 14 | * 15 | */ 16 | 17 | declare(strict_types=1); 18 | 19 | namespace LongitudeOne\Spatial\ORM\Query\AST\Functions\MariaDB; 20 | 21 | use Doctrine\DBAL\Platforms\AbstractPlatform; 22 | use Doctrine\DBAL\Platforms\MariaDBPlatform; 23 | use LongitudeOne\Spatial\ORM\Query\AST\Functions\AbstractSpatialDQLFunction; 24 | 25 | /** 26 | * ST_Overlaps DQL function. 27 | * 28 | * @author Dragos Protung 29 | * @author Alexandre Tranchant 30 | * @license https://alexandre-tranchant.mit-license.org 31 | */ 32 | class SpMbrOverlaps extends AbstractSpatialDQLFunction 33 | { 34 | /** 35 | * Function SQL name getter. 36 | * 37 | * @since 2.0 This function replace the protected property functionName. 38 | */ 39 | protected function getFunctionName(): string 40 | { 41 | return 'ST_Overlaps'; 42 | } 43 | 44 | /** 45 | * Maximum number of parameters for the spatial function. 46 | * 47 | * @since 2.0 This function replace the protected property maxGeomExpr. 48 | * 49 | * @return int the inherited methods shall NOT return null, but 0 when function has no parameter 50 | */ 51 | protected function getMaxParameter(): int 52 | { 53 | return 2; 54 | } 55 | 56 | /** 57 | * Minimum number of parameters for the spatial function. 58 | * 59 | * @since 2.0 This function replace the protected property minGeomExpr. 60 | * 61 | * @return int the inherited methods shall NOT return null, but 0 when function has no parameter 62 | */ 63 | protected function getMinParameter(): int 64 | { 65 | return 2; 66 | } 67 | 68 | /** 69 | * Get the platforms accepted. 70 | * 71 | * @since 2.0 This function replace the protected property platforms. 72 | * @since 5.0 This function returns the class-string[] instead of string[] 73 | * 74 | * @return class-string[] a non-empty array of accepted platforms 75 | */ 76 | protected function getPlatforms(): array 77 | { 78 | return [MariaDBPlatform::class]; 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /lib/LongitudeOne/Spatial/ORM/Query/AST/Functions/MySql/SpDistance.php: -------------------------------------------------------------------------------- 1 | 2017-2025 9 | * Copyright Longitude One 2020-2025 10 | * Copyright 2015 Derek J. Lambert 11 | * 12 | * For the full copyright and license information, please view the LICENSE 13 | * file that was distributed with this source code. 14 | * 15 | */ 16 | 17 | declare(strict_types=1); 18 | 19 | namespace LongitudeOne\Spatial\ORM\Query\AST\Functions\MySql; 20 | 21 | use Doctrine\DBAL\Platforms\AbstractPlatform; 22 | use Doctrine\DBAL\Platforms\MySQLPlatform; 23 | use LongitudeOne\Spatial\ORM\Query\AST\Functions\AbstractSpatialDQLFunction; 24 | 25 | /** 26 | * STDistance DQL function. 27 | * 28 | * @author luca capra 29 | * @author Alexandre Tranchant 30 | * @license https://dlambert.mit-license.org MIT 31 | */ 32 | class SpDistance extends AbstractSpatialDQLFunction 33 | { 34 | /** 35 | * Function SQL name getter. 36 | * 37 | * @since 2.0 This function replace the protected property functionName. 38 | */ 39 | protected function getFunctionName(): string 40 | { 41 | return 'ST_Distance'; 42 | } 43 | 44 | /** 45 | * Maximum number of parameters for the spatial function. 46 | * 47 | * @since 2.0 This function replace the protected property maxGeomExpr. 48 | * 49 | * @return int the inherited methods shall NOT return null, but 0 when function has no parameter 50 | */ 51 | protected function getMaxParameter(): int 52 | { 53 | return 2; 54 | } 55 | 56 | /** 57 | * Minimum number of parameters for the spatial function. 58 | * 59 | * @since 2.0 This function replace the protected property minGeomExpr. 60 | * 61 | * @return int the inherited methods shall NOT return null, but 0 when function has no parameter 62 | */ 63 | protected function getMinParameter(): int 64 | { 65 | return 2; 66 | } 67 | 68 | /** 69 | * Get the platforms accepted. 70 | * 71 | * @since 2.0 This function replace the protected property platforms. 72 | * @since 5.0 This function returns the class-string[] instead of string[] 73 | * 74 | * @return class-string[] a non-empty array of accepted platforms 75 | */ 76 | protected function getPlatforms(): array 77 | { 78 | return [MySQLPlatform::class]; 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /lib/LongitudeOne/Spatial/ORM/Query/AST/Functions/Standard/StPoint.php: -------------------------------------------------------------------------------- 1 | 2017-2025 9 | * Copyright Longitude One 2020-2025 10 | * Copyright 2015 Derek J. Lambert 11 | * 12 | * For the full copyright and license information, please view the LICENSE 13 | * file that was distributed with this source code. 14 | * 15 | */ 16 | 17 | declare(strict_types=1); 18 | 19 | namespace LongitudeOne\Spatial\ORM\Query\AST\Functions\Standard; 20 | 21 | use Doctrine\DBAL\Platforms\AbstractPlatform; 22 | use Doctrine\DBAL\Platforms\PostgreSQLPlatform; 23 | use LongitudeOne\Spatial\ORM\Query\AST\Functions\AbstractSpatialDQLFunction; 24 | 25 | /** 26 | * ST_Point DQL function. 27 | * 28 | * @author Tom Vogt 29 | * @author Alexandre Tranchant 30 | * @license https://alexandre-tranchant.mit-license.org 31 | */ 32 | class StPoint extends AbstractSpatialDQLFunction 33 | { 34 | /** 35 | * Function SQL name getter. 36 | * 37 | * @since 2.0 This function replace the protected property functionName. 38 | */ 39 | protected function getFunctionName(): string 40 | { 41 | return 'ST_Point'; 42 | } 43 | 44 | /** 45 | * Maximum number of parameters for the spatial function. 46 | * 47 | * @since 2.0 This function replace the protected property maxGeomExpr. 48 | * 49 | * @return int the inherited methods shall NOT return null, but 0 when function has no parameter 50 | */ 51 | protected function getMaxParameter(): int 52 | { 53 | return 2; 54 | } 55 | 56 | /** 57 | * Minimum number of parameters for the spatial function. 58 | * 59 | * @since 2.0 This function replace the protected property minGeomExpr. 60 | * 61 | * @return int the inherited methods shall NOT return null, but 0 when function has no parameter 62 | */ 63 | protected function getMinParameter(): int 64 | { 65 | return 2; 66 | } 67 | 68 | /** 69 | * Get the platforms accepted. 70 | * 71 | * @since 2.0 This function replace the protected property platforms. 72 | * @since 5.0 This function returns the class-string[] instead of string[] 73 | * 74 | * @return class-string[] a non-empty array of accepted platforms 75 | */ 76 | protected function getPlatforms(): array 77 | { 78 | return [PostgreSQLPlatform::class]; 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /lib/LongitudeOne/Spatial/ORM/Query/AST/Functions/MySql/SpLineString.php: -------------------------------------------------------------------------------- 1 | 2017-2025 9 | * Copyright Longitude One 2020-2025 10 | * Copyright 2015 Derek J. Lambert 11 | * 12 | * For the full copyright and license information, please view the LICENSE 13 | * file that was distributed with this source code. 14 | * 15 | */ 16 | 17 | declare(strict_types=1); 18 | 19 | namespace LongitudeOne\Spatial\ORM\Query\AST\Functions\MySql; 20 | 21 | use Doctrine\DBAL\Platforms\AbstractPlatform; 22 | use Doctrine\DBAL\Platforms\MySQLPlatform; 23 | use LongitudeOne\Spatial\ORM\Query\AST\Functions\AbstractSpatialDQLFunction; 24 | 25 | /** 26 | * GLength DQL function. 27 | * 28 | * @author Damiano Ciarla 29 | * @author Alexandre Tranchant 30 | * @license https://opensource.org/licenses/MIT MIT 31 | */ 32 | class SpLineString extends AbstractSpatialDQLFunction 33 | { 34 | /** 35 | * Function SQL name getter. 36 | * 37 | * @since 2.0 This function replace the protected property functionName. 38 | */ 39 | protected function getFunctionName(): string 40 | { 41 | return 'LineString'; 42 | } 43 | 44 | /** 45 | * Maximum number of parameters for the spatial function. 46 | * 47 | * @since 2.0 This function replace the protected property maxGeomExpr. 48 | * 49 | * @return int the inherited methods shall NOT return null, but 0 when function has no parameter 50 | */ 51 | protected function getMaxParameter(): int 52 | { 53 | return 2; 54 | } 55 | 56 | /** 57 | * Minimum number of parameters for the spatial function. 58 | * 59 | * @since 2.0 This function replace the protected property minGeomExpr. 60 | * 61 | * @return int the inherited methods shall NOT return null, but 0 when function has no parameter 62 | */ 63 | protected function getMinParameter(): int 64 | { 65 | return 2; 66 | } 67 | 68 | /** 69 | * Get the platforms accepted. 70 | * 71 | * @since 2.0 This function replace the protected property platforms. 72 | * @since 5.0 This function returns the class-string[] instead of string[] 73 | * 74 | * @return class-string[] a non-empty array of accepted platforms 75 | */ 76 | protected function getPlatforms(): array 77 | { 78 | return [MySQLPlatform::class]; 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /lib/LongitudeOne/Spatial/ORM/Query/AST/Functions/PostgreSql/SpMakePoint.php: -------------------------------------------------------------------------------- 1 | 2017-2025 9 | * Copyright Longitude One 2020-2025 10 | * Copyright 2015 Derek J. Lambert 11 | * 12 | * For the full copyright and license information, please view the LICENSE 13 | * file that was distributed with this source code. 14 | * 15 | */ 16 | 17 | declare(strict_types=1); 18 | 19 | namespace LongitudeOne\Spatial\ORM\Query\AST\Functions\PostgreSql; 20 | 21 | use Doctrine\DBAL\Platforms\AbstractPlatform; 22 | use Doctrine\DBAL\Platforms\PostgreSQLPlatform; 23 | use LongitudeOne\Spatial\ORM\Query\AST\Functions\AbstractSpatialDQLFunction; 24 | 25 | /** 26 | * ST_MakePoint DQL function. 27 | * 28 | * @author David Pacheco 29 | * @author Alexandre Tranchant 30 | * @license https://alexandre-tranchant.mit-license.org 31 | */ 32 | class SpMakePoint extends AbstractSpatialDQLFunction 33 | { 34 | /** 35 | * Function SQL name getter. 36 | * 37 | * @since 2.0 This function replace the protected property functionName. 38 | */ 39 | protected function getFunctionName(): string 40 | { 41 | return 'ST_MakePoint'; 42 | } 43 | 44 | /** 45 | * Maximum number of parameter for the spatial function. 46 | * 47 | * @since 2.0 This function replace the protected property maxGeomExpr. 48 | * 49 | * @return int the inherited methods shall NOT return null, but 0 when function has no parameter 50 | */ 51 | protected function getMaxParameter(): int 52 | { 53 | return 4; 54 | } 55 | 56 | /** 57 | * Minimum number of parameter for the spatial function. 58 | * 59 | * @since 2.0 This function replace the protected property minGeomExpr. 60 | * 61 | * @return int the inherited methods shall NOT return null, but 0 when function has no parameter 62 | */ 63 | protected function getMinParameter(): int 64 | { 65 | return 2; 66 | } 67 | 68 | /** 69 | * Get the platforms accepted. 70 | * 71 | * @since 2.0 This function replace the protected property platforms. 72 | * @since 5.0 This function returns the class-string[] instead of string[] 73 | * 74 | * @return class-string[] a non-empty array of accepted platforms 75 | */ 76 | protected function getPlatforms(): array 77 | { 78 | return [PostgreSQLPlatform::class]; 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /lib/LongitudeOne/Spatial/ORM/Query/AST/Functions/MariaDB/SpDistance.php: -------------------------------------------------------------------------------- 1 | 2017-2025 9 | * Copyright Longitude One 2020-2025 10 | * Copyright 2015 Derek J. Lambert 11 | * 12 | * For the full copyright and license information, please view the LICENSE 13 | * file that was distributed with this source code. 14 | * 15 | */ 16 | 17 | declare(strict_types=1); 18 | 19 | namespace LongitudeOne\Spatial\ORM\Query\AST\Functions\MariaDB; 20 | 21 | use Doctrine\DBAL\Platforms\AbstractPlatform; 22 | use Doctrine\DBAL\Platforms\MariaDBPlatform; 23 | use LongitudeOne\Spatial\ORM\Query\AST\Functions\AbstractSpatialDQLFunction; 24 | 25 | /** 26 | * STDistance DQL function. 27 | * 28 | * @author luca capra 29 | * @author Alexandre Tranchant 30 | * @license https://dlambert.mit-license.org MIT 31 | */ 32 | class SpDistance extends AbstractSpatialDQLFunction 33 | { 34 | /** 35 | * Function SQL name getter. 36 | * 37 | * @since 2.0 This function replace the protected property functionName. 38 | */ 39 | protected function getFunctionName(): string 40 | { 41 | return 'ST_Distance'; 42 | } 43 | 44 | /** 45 | * Maximum number of parameters for the spatial function. 46 | * 47 | * @since 2.0 This function replace the protected property maxGeomExpr. 48 | * 49 | * @return int the inherited methods shall NOT return null, but 0 when function has no parameter 50 | */ 51 | protected function getMaxParameter(): int 52 | { 53 | return 2; 54 | } 55 | 56 | /** 57 | * Minimum number of parameters for the spatial function. 58 | * 59 | * @since 2.0 This function replace the protected property minGeomExpr. 60 | * 61 | * @return int the inherited methods shall NOT return null, but 0 when function has no parameter 62 | */ 63 | protected function getMinParameter(): int 64 | { 65 | return 2; 66 | } 67 | 68 | /** 69 | * Get the platforms accepted. 70 | * 71 | * @since 2.0 This function replace the protected property platforms. 72 | * @since 5.0 This function returns the class-string[] instead of string[] 73 | * 74 | * @return class-string[] a non-empty array of accepted platforms 75 | */ 76 | protected function getPlatforms(): array 77 | { 78 | return [MariaDBPlatform::class]; 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /lib/LongitudeOne/Spatial/ORM/Query/AST/Functions/MySql/SpPoint.php: -------------------------------------------------------------------------------- 1 | 2017-2025 9 | * Copyright Longitude One 2020-2025 10 | * Copyright 2015 Derek J. Lambert 11 | * 12 | * For the full copyright and license information, please view the LICENSE 13 | * file that was distributed with this source code. 14 | * 15 | */ 16 | 17 | declare(strict_types=1); 18 | 19 | namespace LongitudeOne\Spatial\ORM\Query\AST\Functions\MySql; 20 | 21 | use Doctrine\DBAL\Platforms\AbstractPlatform; 22 | use Doctrine\DBAL\Platforms\MySQLPlatform; 23 | use LongitudeOne\Spatial\ORM\Query\AST\Functions\AbstractSpatialDQLFunction; 24 | 25 | /** 26 | * Point function. 27 | * 28 | * @author Alexandre Tranchant 29 | * @license https://alexandre-tranchant.mit-license.org 30 | */ 31 | class SpPoint extends AbstractSpatialDQLFunction 32 | { 33 | /** 34 | * Function SQL name getter. 35 | * Mysql does not implement OGC function ST_Point. Use this version. 36 | * 37 | * @since 2.0 This function replace the protected property functionName. 38 | */ 39 | protected function getFunctionName(): string 40 | { 41 | return 'Point'; 42 | } 43 | 44 | /** 45 | * Maximum number of parameters for the spatial function. 46 | * 47 | * @since 2.0 This function replace the protected property maxGeomExpr. 48 | * 49 | * @return int the inherited methods shall NOT return null, but 0 when function has no parameter 50 | */ 51 | protected function getMaxParameter(): int 52 | { 53 | return 2; 54 | } 55 | 56 | /** 57 | * Minimum number of parameters for the spatial function. 58 | * 59 | * @since 2.0 This function replace the protected property minGeomExpr. 60 | * 61 | * @return int the inherited methods shall NOT return null, but 0 when function has no parameter 62 | */ 63 | protected function getMinParameter(): int 64 | { 65 | return 2; 66 | } 67 | 68 | /** 69 | * Get the platforms accepted. 70 | * 71 | * @since 2.0 This function replace the protected property platforms. 72 | * @since 5.0 This function returns the class-string[] instead of string[] 73 | * 74 | * @return class-string[] a non-empty array of accepted platforms 75 | */ 76 | protected function getPlatforms(): array 77 | { 78 | return [MySQLPlatform::class]; 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /lib/LongitudeOne/Spatial/ORM/Query/AST/Functions/PostgreSql/SpAzimuth.php: -------------------------------------------------------------------------------- 1 | 2017-2025 9 | * Copyright Longitude One 2020-2025 10 | * Copyright 2015 Derek J. Lambert 11 | * 12 | * For the full copyright and license information, please view the LICENSE 13 | * file that was distributed with this source code. 14 | * 15 | */ 16 | 17 | declare(strict_types=1); 18 | 19 | namespace LongitudeOne\Spatial\ORM\Query\AST\Functions\PostgreSql; 20 | 21 | use Doctrine\DBAL\Platforms\AbstractPlatform; 22 | use Doctrine\DBAL\Platforms\PostgreSQLPlatform; 23 | use LongitudeOne\Spatial\ORM\Query\AST\Functions\AbstractSpatialDQLFunction; 24 | 25 | /** 26 | * SP_Azimuth DQL function. 27 | * 28 | * @author Tom Vogt 29 | * @author Alexandre Tranchant 30 | * @license https://alexandre-tranchant.mit-license.org 31 | */ 32 | class SpAzimuth extends AbstractSpatialDQLFunction 33 | { 34 | /** 35 | * Function SQL name getter. 36 | * 37 | * @since 2.0 This function replace the protected property functionName. 38 | */ 39 | protected function getFunctionName(): string 40 | { 41 | return 'ST_Azimuth'; 42 | } 43 | 44 | /** 45 | * Maximum number of parameter for the spatial function. 46 | * 47 | * @since 2.0 This function replace the protected property maxGeomExpr. 48 | * 49 | * @return int the inherited methods shall NOT return null, but 0 when function has no parameter 50 | */ 51 | protected function getMaxParameter(): int 52 | { 53 | return 2; 54 | } 55 | 56 | /** 57 | * Minimum number of parameter for the spatial function. 58 | * 59 | * @since 2.0 This function replace the protected property minGeomExpr. 60 | * 61 | * @return int the inherited methods shall NOT return null, but 0 when function has no parameter 62 | */ 63 | protected function getMinParameter(): int 64 | { 65 | return 2; 66 | } 67 | 68 | /** 69 | * Get the platforms accepted. 70 | * 71 | * @since 2.0 This function replace the protected property platforms. 72 | * @since 5.0 This function returns the class-string[] instead of string[] 73 | * 74 | * @return class-string[] a non-empty array of accepted platforms 75 | */ 76 | protected function getPlatforms(): array 77 | { 78 | return [PostgreSQLPlatform::class]; 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /lib/LongitudeOne/Spatial/ORM/Query/AST/Functions/MariaDB/SpLineString.php: -------------------------------------------------------------------------------- 1 | 2017-2025 9 | * Copyright Longitude One 2020-2025 10 | * Copyright 2015 Derek J. Lambert 11 | * 12 | * For the full copyright and license information, please view the LICENSE 13 | * file that was distributed with this source code. 14 | * 15 | */ 16 | 17 | declare(strict_types=1); 18 | 19 | namespace LongitudeOne\Spatial\ORM\Query\AST\Functions\MariaDB; 20 | 21 | use Doctrine\DBAL\Platforms\AbstractPlatform; 22 | use Doctrine\DBAL\Platforms\MariaDBPlatform; 23 | use LongitudeOne\Spatial\ORM\Query\AST\Functions\AbstractSpatialDQLFunction; 24 | 25 | /** 26 | * GLength DQL function. 27 | * 28 | * @author Damiano Ciarla 29 | * @author Alexandre Tranchant 30 | * @license https://opensource.org/licenses/MIT MIT 31 | */ 32 | class SpLineString extends AbstractSpatialDQLFunction 33 | { 34 | /** 35 | * Function SQL name getter. 36 | * 37 | * @since 2.0 This function replace the protected property functionName. 38 | */ 39 | protected function getFunctionName(): string 40 | { 41 | return 'LineString'; 42 | } 43 | 44 | /** 45 | * Maximum number of parameters for the spatial function. 46 | * 47 | * @since 2.0 This function replace the protected property maxGeomExpr. 48 | * 49 | * @return int the inherited methods shall NOT return null, but 0 when function has no parameter 50 | */ 51 | protected function getMaxParameter(): int 52 | { 53 | return 2; 54 | } 55 | 56 | /** 57 | * Minimum number of parameters for the spatial function. 58 | * 59 | * @since 2.0 This function replace the protected property minGeomExpr. 60 | * 61 | * @return int the inherited methods shall NOT return null, but 0 when function has no parameter 62 | */ 63 | protected function getMinParameter(): int 64 | { 65 | return 2; 66 | } 67 | 68 | /** 69 | * Get the platforms accepted. 70 | * 71 | * @since 2.0 This function replace the protected property platforms. 72 | * @since 5.0 This function returns the class-string[] instead of string[] 73 | * 74 | * @return class-string[] a non-empty array of accepted platforms 75 | */ 76 | protected function getPlatforms(): array 77 | { 78 | return [MariaDBPlatform::class]; 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /lib/LongitudeOne/Spatial/ORM/Query/AST/Functions/MariaDB/SpPoint.php: -------------------------------------------------------------------------------- 1 | 2017-2025 9 | * Copyright Longitude One 2020-2025 10 | * Copyright 2015 Derek J. Lambert 11 | * 12 | * For the full copyright and license information, please view the LICENSE 13 | * file that was distributed with this source code. 14 | * 15 | */ 16 | 17 | declare(strict_types=1); 18 | 19 | namespace LongitudeOne\Spatial\ORM\Query\AST\Functions\MariaDB; 20 | 21 | use Doctrine\DBAL\Platforms\AbstractPlatform; 22 | use Doctrine\DBAL\Platforms\MariaDBPlatform; 23 | use LongitudeOne\Spatial\ORM\Query\AST\Functions\AbstractSpatialDQLFunction; 24 | 25 | /** 26 | * Point function. 27 | * 28 | * @author Alexandre Tranchant 29 | * @license https://alexandre-tranchant.mit-license.org 30 | */ 31 | class SpPoint extends AbstractSpatialDQLFunction 32 | { 33 | /** 34 | * Function SQL name getter. 35 | * MariaDB does not implement OGC function ST_Point. Use this version. 36 | * 37 | * @since 2.0 This function replace the protected property functionName. 38 | */ 39 | protected function getFunctionName(): string 40 | { 41 | return 'Point'; 42 | } 43 | 44 | /** 45 | * Maximum number of parameters for the spatial function. 46 | * 47 | * @since 2.0 This function replace the protected property maxGeomExpr. 48 | * 49 | * @return int the inherited methods shall NOT return null, but 0 when function has no parameter 50 | */ 51 | protected function getMaxParameter(): int 52 | { 53 | return 2; 54 | } 55 | 56 | /** 57 | * Minimum number of parameters for the spatial function. 58 | * 59 | * @since 2.0 This function replace the protected property minGeomExpr. 60 | * 61 | * @return int the inherited methods shall NOT return null, but 0 when function has no parameter 62 | */ 63 | protected function getMinParameter(): int 64 | { 65 | return 2; 66 | } 67 | 68 | /** 69 | * Get the platforms accepted. 70 | * 71 | * @since 2.0 This function replace the protected property platforms. 72 | * @since 5.0 This function returns the class-string[] instead of string[] 73 | * 74 | * @return class-string[] a non-empty array of accepted platforms 75 | */ 76 | protected function getPlatforms(): array 77 | { 78 | return [MariaDBPlatform::class]; 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /lib/LongitudeOne/Spatial/ORM/Query/AST/Functions/PostgreSql/SpCollect.php: -------------------------------------------------------------------------------- 1 | 2017-2025 9 | * Copyright Longitude One 2020-2025 10 | * Copyright 2015 Derek J. Lambert 11 | * 12 | * For the full copyright and license information, please view the LICENSE 13 | * file that was distributed with this source code. 14 | * 15 | */ 16 | 17 | declare(strict_types=1); 18 | 19 | namespace LongitudeOne\Spatial\ORM\Query\AST\Functions\PostgreSql; 20 | 21 | use Doctrine\DBAL\Platforms\AbstractPlatform; 22 | use Doctrine\DBAL\Platforms\PostgreSQLPlatform; 23 | use LongitudeOne\Spatial\ORM\Query\AST\Functions\AbstractSpatialDQLFunction; 24 | 25 | /** 26 | * ST_Collect DQL function. 27 | * 28 | * @author Derek J. Lambert 29 | * @author Alexandre Tranchant 30 | * @license https://dlambert.mit-license.org MIT 31 | */ 32 | class SpCollect extends AbstractSpatialDQLFunction 33 | { 34 | /** 35 | * Function SQL name getter. 36 | * 37 | * @since 2.0 This function replace the protected property functionName. 38 | */ 39 | protected function getFunctionName(): string 40 | { 41 | return 'ST_Collect'; 42 | } 43 | 44 | /** 45 | * Maximum number of parameter for the spatial function. 46 | * 47 | * @since 2.0 This function replace the protected property maxGeomExpr. 48 | * 49 | * @return int the inherited methods shall NOT return null, but 0 when function has no parameter 50 | */ 51 | protected function getMaxParameter(): int 52 | { 53 | return 2; 54 | } 55 | 56 | /** 57 | * Minimum number of parameter for the spatial function. 58 | * 59 | * @since 2.0 This function replace the protected property minGeomExpr. 60 | * 61 | * @return int the inherited methods shall NOT return null, but 0 when function has no parameter 62 | */ 63 | protected function getMinParameter(): int 64 | { 65 | return 1; 66 | } 67 | 68 | /** 69 | * Get the platforms accepted. 70 | * 71 | * @since 2.0 This function replace the protected property platforms. 72 | * @since 5.0 This function returns the class-string[] instead of string[] 73 | * 74 | * @return class-string[] a non-empty array of accepted platforms 75 | */ 76 | protected function getPlatforms(): array 77 | { 78 | return [PostgreSQLPlatform::class]; 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /lib/LongitudeOne/Spatial/ORM/Query/AST/Functions/PostgreSql/SpMakeBox2D.php: -------------------------------------------------------------------------------- 1 | 2017-2025 9 | * Copyright Longitude One 2020-2025 10 | * Copyright 2015 Derek J. Lambert 11 | * 12 | * For the full copyright and license information, please view the LICENSE 13 | * file that was distributed with this source code. 14 | * 15 | */ 16 | 17 | declare(strict_types=1); 18 | 19 | namespace LongitudeOne\Spatial\ORM\Query\AST\Functions\PostgreSql; 20 | 21 | use Doctrine\DBAL\Platforms\AbstractPlatform; 22 | use Doctrine\DBAL\Platforms\PostgreSQLPlatform; 23 | use LongitudeOne\Spatial\ORM\Query\AST\Functions\AbstractSpatialDQLFunction; 24 | 25 | /** 26 | * ST_MakeBox2D DQL function. 27 | * 28 | * @author Tom Vogt 29 | * @author Alexandre Tranchant 30 | * @license https://alexandre-tranchant.mit-license.org 31 | */ 32 | class SpMakeBox2D extends AbstractSpatialDQLFunction 33 | { 34 | /** 35 | * Function SQL name getter. 36 | * 37 | * @since 2.0 This function replace the protected property functionName. 38 | */ 39 | protected function getFunctionName(): string 40 | { 41 | return 'ST_MakeBox2D'; 42 | } 43 | 44 | /** 45 | * Maximum number of parameter for the spatial function. 46 | * 47 | * @since 2.0 This function replace the protected property maxGeomExpr. 48 | * 49 | * @return int the inherited methods shall NOT return null, but 0 when function has no parameter 50 | */ 51 | protected function getMaxParameter(): int 52 | { 53 | return 2; 54 | } 55 | 56 | /** 57 | * Minimum number of parameter for the spatial function. 58 | * 59 | * @since 2.0 This function replace the protected property minGeomExpr. 60 | * 61 | * @return int the inherited methods shall NOT return null, but 0 when function has no parameter 62 | */ 63 | protected function getMinParameter(): int 64 | { 65 | return 2; 66 | } 67 | 68 | /** 69 | * Get the platforms accepted. 70 | * 71 | * @since 2.0 This function replace the protected property platforms. 72 | * @since 5.0 This function returns the class-string[] instead of string[] 73 | * 74 | * @return class-string[] a non-empty array of accepted platforms 75 | */ 76 | protected function getPlatforms(): array 77 | { 78 | return [PostgreSQLPlatform::class]; 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /lib/LongitudeOne/Spatial/ORM/Query/AST/Functions/PostgreSql/SpMakeEnvelope.php: -------------------------------------------------------------------------------- 1 | 2017-2025 9 | * Copyright Longitude One 2020-2025 10 | * Copyright 2015 Derek J. Lambert 11 | * 12 | * For the full copyright and license information, please view the LICENSE 13 | * file that was distributed with this source code. 14 | * 15 | */ 16 | 17 | declare(strict_types=1); 18 | 19 | namespace LongitudeOne\Spatial\ORM\Query\AST\Functions\PostgreSql; 20 | 21 | use Doctrine\DBAL\Platforms\AbstractPlatform; 22 | use Doctrine\DBAL\Platforms\PostgreSQLPlatform; 23 | use LongitudeOne\Spatial\ORM\Query\AST\Functions\AbstractSpatialDQLFunction; 24 | 25 | /** 26 | * ST_MakeEnvelope DQL function. 27 | * 28 | * @author Dragos Protung 29 | * @author Alexandre Tranchant 30 | * @license https://alexandre-tranchant.mit-license.org 31 | */ 32 | class SpMakeEnvelope extends AbstractSpatialDQLFunction 33 | { 34 | /** 35 | * Function SQL name getter. 36 | * 37 | * @since 2.0 This function replace the protected property functionName. 38 | */ 39 | protected function getFunctionName(): string 40 | { 41 | return 'ST_MakeEnvelope'; 42 | } 43 | 44 | /** 45 | * Maximum number of parameter for the spatial function. 46 | * 47 | * @since 2.0 This function replace the protected property maxGeomExpr. 48 | * 49 | * @return int the inherited methods shall NOT return null, but 0 when function has no parameter 50 | */ 51 | protected function getMaxParameter(): int 52 | { 53 | return 5; 54 | } 55 | 56 | /** 57 | * Minimum number of parameter for the spatial function. 58 | * 59 | * @since 2.0 This function replace the protected property minGeomExpr. 60 | * 61 | * @return int the inherited methods shall NOT return null, but 0 when function has no parameter 62 | */ 63 | protected function getMinParameter(): int 64 | { 65 | return 4; 66 | } 67 | 68 | /** 69 | * Get the platforms accepted. 70 | * 71 | * @since 2.0 This function replace the protected property platforms. 72 | * @since 5.0 This function returns the class-string[] instead of string[] 73 | * 74 | * @return class-string[] a non-empty array of accepted platforms 75 | */ 76 | protected function getPlatforms(): array 77 | { 78 | return [PostgreSQLPlatform::class]; 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /lib/LongitudeOne/Spatial/ORM/Query/AST/Functions/PostgreSql/SpSummary.php: -------------------------------------------------------------------------------- 1 | 2017-2025 9 | * Copyright Longitude One 2020-2025 10 | * Copyright 2015 Derek J. Lambert 11 | * 12 | * For the full copyright and license information, please view the LICENSE 13 | * file that was distributed with this source code. 14 | * 15 | */ 16 | 17 | declare(strict_types=1); 18 | 19 | namespace LongitudeOne\Spatial\ORM\Query\AST\Functions\PostgreSql; 20 | 21 | use Doctrine\DBAL\Platforms\AbstractPlatform; 22 | use Doctrine\DBAL\Platforms\PostgreSQLPlatform; 23 | use LongitudeOne\Spatial\ORM\Query\AST\Functions\AbstractSpatialDQLFunction; 24 | 25 | /** 26 | * ST_Summary DQL function. 27 | * 28 | * @author Derek J. Lambert 29 | * @author Alexandre Tranchant 30 | * @license https://dlambert.mit-license.org MIT 31 | */ 32 | class SpSummary extends AbstractSpatialDQLFunction 33 | { 34 | /** 35 | * Function SQL name getter. 36 | * 37 | * @since 2.0 This function replace the protected property functionName. 38 | */ 39 | protected function getFunctionName(): string 40 | { 41 | return 'ST_Summary'; 42 | } 43 | 44 | /** 45 | * Maximum number of parameter for the spatial function. 46 | * 47 | * @since 2.0 This function replace the protected property maxGeomExpr. 48 | * 49 | * @return int the inherited methods shall NOT return null, but 0 when function has no parameter 50 | */ 51 | protected function getMaxParameter(): int 52 | { 53 | return 1; 54 | } 55 | 56 | /** 57 | * Minimum number of parameter for the spatial function. 58 | * 59 | * @since 2.0 This function replace the protected property minGeomExpr. 60 | * 61 | * @return int the inherited methods shall NOT return null, but 0 when function has no parameter 62 | */ 63 | protected function getMinParameter(): int 64 | { 65 | return 1; 66 | } 67 | 68 | /** 69 | * Get the platforms accepted. 70 | * 71 | * @since 2.0 This function replace the protected property platforms. 72 | * @since 5.0 This function returns the class-string[] instead of string[] 73 | * 74 | * @return class-string[] a non-empty array of accepted platforms 75 | */ 76 | protected function getPlatforms(): array 77 | { 78 | return [PostgreSQLPlatform::class]; 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /lib/LongitudeOne/Spatial/ORM/Query/AST/Functions/Standard/StDistance.php: -------------------------------------------------------------------------------- 1 | 2017-2025 9 | * Copyright Longitude One 2020-2025 10 | * Copyright 2015 Derek J. Lambert 11 | * 12 | * For the full copyright and license information, please view the LICENSE 13 | * file that was distributed with this source code. 14 | * 15 | */ 16 | 17 | declare(strict_types=1); 18 | 19 | namespace LongitudeOne\Spatial\ORM\Query\AST\Functions\Standard; 20 | 21 | use Doctrine\DBAL\Platforms\AbstractPlatform; 22 | use Doctrine\DBAL\Platforms\PostgreSQLPlatform; 23 | use LongitudeOne\Spatial\ORM\Query\AST\Functions\AbstractSpatialDQLFunction; 24 | 25 | /** 26 | * ST_Contains DQL function. 27 | * 28 | * @author Derek J. Lambert 29 | * @author Alexandre Tranchant 30 | * @license https://dlambert.mit-license.org MIT 31 | */ 32 | class StDistance extends AbstractSpatialDQLFunction 33 | { 34 | /** 35 | * Function SQL name getter. 36 | * 37 | * @since 2.0 This function replace the protected property functionName. 38 | */ 39 | protected function getFunctionName(): string 40 | { 41 | return 'ST_Distance'; 42 | } 43 | 44 | /** 45 | * Maximum number of parameter for the spatial function. 46 | * 47 | * @since 2.0 This function replace the protected property maxGeomExpr. 48 | * 49 | * @return int the inherited methods shall NOT return null, but 0 when function has no parameter 50 | */ 51 | protected function getMaxParameter(): int 52 | { 53 | return 3; 54 | } 55 | 56 | /** 57 | * Minimum number of parameter for the spatial function. 58 | * 59 | * @since 2.0 This function replace the protected property minGeomExpr. 60 | * 61 | * @return int the inherited methods shall NOT return null, but 0 when function has no parameter 62 | */ 63 | protected function getMinParameter(): int 64 | { 65 | return 2; 66 | } 67 | 68 | /** 69 | * Get the platforms accepted. 70 | * 71 | * @since 2.0 This function replace the protected property platforms. 72 | * @since 5.0 This function returns the class-string[] instead of string[] 73 | * 74 | * @return class-string[] a non-empty array of accepted platforms 75 | */ 76 | protected function getPlatforms(): array 77 | { 78 | return [PostgreSQLPlatform::class]; 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /lib/LongitudeOne/Spatial/ORM/Query/AST/Functions/PostgreSql/SpCovers.php: -------------------------------------------------------------------------------- 1 | 2017-2025 9 | * Copyright Longitude One 2020-2025 10 | * Copyright 2015 Derek J. Lambert 11 | * 12 | * For the full copyright and license information, please view the LICENSE 13 | * file that was distributed with this source code. 14 | * 15 | */ 16 | 17 | declare(strict_types=1); 18 | 19 | namespace LongitudeOne\Spatial\ORM\Query\AST\Functions\PostgreSql; 20 | 21 | use Doctrine\DBAL\Platforms\AbstractPlatform; 22 | use Doctrine\DBAL\Platforms\PostgreSQLPlatform; 23 | use LongitudeOne\Spatial\ORM\Query\AST\Functions\AbstractSpatialDQLFunction; 24 | 25 | /** 26 | * ST_Covers DQL function. 27 | * 28 | * @author Derek J. Lambert 29 | * @author Alexandre Tranchant 30 | * @license https://alexandre-tranchant.mit-license.org 31 | */ 32 | class SpCovers extends AbstractSpatialDQLFunction 33 | { 34 | /** 35 | * Function SQL name getter. 36 | * 37 | * @since 2.0 This function replace the protected property functionName. 38 | */ 39 | protected function getFunctionName(): string 40 | { 41 | return 'ST_Covers'; 42 | } 43 | 44 | /** 45 | * Maximum number of parameter for the spatial function. 46 | * 47 | * @since 2.0 This function replace the protected property maxGeomExpr. 48 | * 49 | * @return int the inherited methods shall NOT return null, but 0 when function has no parameter 50 | */ 51 | protected function getMaxParameter(): int 52 | { 53 | return 2; 54 | } 55 | 56 | /** 57 | * Minimum number of parameter for the spatial function. 58 | * 59 | * @since 2.0 This function replace the protected property minGeomExpr. 60 | * 61 | * @return int the inherited methods shall NOT return null, but 0 when function has no parameter 62 | */ 63 | protected function getMinParameter(): int 64 | { 65 | return 2; 66 | } 67 | 68 | /** 69 | * Get the platforms accepted. 70 | * 71 | * @since 2.0 This function replace the protected property platforms. 72 | * @since 5.0 This function returns the class-string[] instead of string[] 73 | * 74 | * @return class-string[] a non-empty array of accepted platforms 75 | */ 76 | protected function getPlatforms(): array 77 | { 78 | return [PostgreSQLPlatform::class]; 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /lib/LongitudeOne/Spatial/ORM/Query/AST/Functions/PostgreSql/SpTransform.php: -------------------------------------------------------------------------------- 1 | 2017-2025 9 | * Copyright Longitude One 2020-2025 10 | * Copyright 2015 Derek J. Lambert 11 | * 12 | * For the full copyright and license information, please view the LICENSE 13 | * file that was distributed with this source code. 14 | * 15 | */ 16 | 17 | declare(strict_types=1); 18 | 19 | namespace LongitudeOne\Spatial\ORM\Query\AST\Functions\PostgreSql; 20 | 21 | use Doctrine\DBAL\Platforms\AbstractPlatform; 22 | use Doctrine\DBAL\Platforms\PostgreSQLPlatform; 23 | use LongitudeOne\Spatial\ORM\Query\AST\Functions\AbstractSpatialDQLFunction; 24 | 25 | /** 26 | * SP_Transform DQL function. 27 | * 28 | * TODO #62 Fix test of this function. 29 | * 30 | * @author Alexandre Tranchant 31 | * @license https://alexandre-tranchant.mit-license.org 32 | */ 33 | class SpTransform extends AbstractSpatialDQLFunction 34 | { 35 | /** 36 | * Function SQL name getter. 37 | * 38 | * @since 2.0 This function replace the protected property functionName. 39 | */ 40 | protected function getFunctionName(): string 41 | { 42 | return 'ST_Transform'; 43 | } 44 | 45 | /** 46 | * Maximum number of parameter for the spatial function. 47 | * 48 | * @since 2.0 This function replace the protected property maxGeomExpr. 49 | * 50 | * @return int the inherited methods shall NOT return null, but 0 when function has no parameter 51 | */ 52 | protected function getMaxParameter(): int 53 | { 54 | return 3; 55 | } 56 | 57 | /** 58 | * Minimum number of parameter for the spatial function. 59 | * 60 | * @since 2.0 This function replace the protected property minGeomExpr. 61 | * 62 | * @return int the inherited methods shall NOT return null, but 0 when function has no parameter 63 | */ 64 | protected function getMinParameter(): int 65 | { 66 | return 2; 67 | } 68 | 69 | /** 70 | * Get the platforms accepted. 71 | * 72 | * @since 2.0 This function replace the protected property platforms. 73 | * @since 5.0 This function returns the class-string[] instead of string[] 74 | * 75 | * @return class-string[] a non-empty array of accepted platforms 76 | */ 77 | protected function getPlatforms(): array 78 | { 79 | return [PostgreSQLPlatform::class]; 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /lib/LongitudeOne/Spatial/ORM/Query/AST/Functions/PostgreSql/SpGeogFromText.php: -------------------------------------------------------------------------------- 1 | 2017-2025 9 | * Copyright Longitude One 2020-2025 10 | * Copyright 2015 Derek J. Lambert 11 | * 12 | * For the full copyright and license information, please view the LICENSE 13 | * file that was distributed with this source code. 14 | * 15 | */ 16 | 17 | declare(strict_types=1); 18 | 19 | namespace LongitudeOne\Spatial\ORM\Query\AST\Functions\PostgreSql; 20 | 21 | use Doctrine\DBAL\Platforms\AbstractPlatform; 22 | use Doctrine\DBAL\Platforms\PostgreSQLPlatform; 23 | use LongitudeOne\Spatial\ORM\Query\AST\Functions\AbstractSpatialDQLFunction; 24 | 25 | /** 26 | * SP_GeogFromText DQL function. 27 | * This function accept EWKT Text. 28 | * 29 | * @author Alexandre Tranchant 30 | * @license https://alexandre-tranchant.mit-license.org MIT 31 | */ 32 | class SpGeogFromText extends AbstractSpatialDQLFunction 33 | { 34 | /** 35 | * Function SQL name getter. 36 | * 37 | * @since 2.0 This function replace the protected property functionName. 38 | */ 39 | protected function getFunctionName(): string 40 | { 41 | return 'ST_GeogFromText'; 42 | } 43 | 44 | /** 45 | * Maximum number of parameter for the spatial function. 46 | * 47 | * @since 2.0 This function replace the protected property maxGeomExpr. 48 | * 49 | * @return int the inherited methods shall NOT return null, but 0 when function has no parameter 50 | */ 51 | protected function getMaxParameter(): int 52 | { 53 | return 2; 54 | } 55 | 56 | /** 57 | * Minimum number of parameter for the spatial function. 58 | * 59 | * @since 2.0 This function replace the protected property minGeomExpr. 60 | * 61 | * @return int the inherited methods shall NOT return null, but 0 when function has no parameter 62 | */ 63 | protected function getMinParameter(): int 64 | { 65 | return 1; 66 | } 67 | 68 | /** 69 | * Get the platforms accepted. 70 | * 71 | * @since 2.0 This function replace the protected property platforms. 72 | * @since 5.0 This function returns the class-string[] instead of string[] 73 | * 74 | * @return class-string[] a non-empty array of accepted platforms 75 | */ 76 | protected function getPlatforms(): array 77 | { 78 | return [PostgreSQLPlatform::class]; 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /lib/LongitudeOne/Spatial/ORM/Query/AST/Functions/PostgreSql/SpCoveredBy.php: -------------------------------------------------------------------------------- 1 | 2017-2025 9 | * Copyright Longitude One 2020-2025 10 | * Copyright 2015 Derek J. Lambert 11 | * 12 | * For the full copyright and license information, please view the LICENSE 13 | * file that was distributed with this source code. 14 | * 15 | */ 16 | 17 | declare(strict_types=1); 18 | 19 | namespace LongitudeOne\Spatial\ORM\Query\AST\Functions\PostgreSql; 20 | 21 | use Doctrine\DBAL\Platforms\AbstractPlatform; 22 | use Doctrine\DBAL\Platforms\PostgreSQLPlatform; 23 | use LongitudeOne\Spatial\ORM\Query\AST\Functions\AbstractSpatialDQLFunction; 24 | 25 | /** 26 | * SP_CoveredBy DQL function. 27 | * 28 | * @author Derek J. Lambert 29 | * @author Alexandre Tranchant 30 | * @license https://alexandre-tranchant.mit-license.org 31 | */ 32 | class SpCoveredBy extends AbstractSpatialDQLFunction 33 | { 34 | /** 35 | * Function SQL name getter. 36 | * 37 | * @since 2.0 This function replace the protected property functionName. 38 | */ 39 | protected function getFunctionName(): string 40 | { 41 | return 'ST_CoveredBy'; 42 | } 43 | 44 | /** 45 | * Maximum number of parameter for the spatial function. 46 | * 47 | * @since 2.0 This function replace the protected property maxGeomExpr. 48 | * 49 | * @return int the inherited methods shall NOT return null, but 0 when function has no parameter 50 | */ 51 | protected function getMaxParameter(): int 52 | { 53 | return 2; 54 | } 55 | 56 | /** 57 | * Minimum number of parameter for the spatial function. 58 | * 59 | * @since 2.0 This function replace the protected property minGeomExpr. 60 | * 61 | * @return int the inherited methods shall NOT return null, but 0 when function has no parameter 62 | */ 63 | protected function getMinParameter(): int 64 | { 65 | return 2; 66 | } 67 | 68 | /** 69 | * Get the platforms accepted. 70 | * 71 | * @since 2.0 This function replace the protected property platforms. 72 | * @since 5.0 This function returns the class-string[] instead of string[] 73 | * 74 | * @return class-string[] a non-empty array of accepted platforms 75 | */ 76 | protected function getPlatforms(): array 77 | { 78 | return [PostgreSQLPlatform::class]; 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /lib/LongitudeOne/Spatial/ORM/Query/AST/Functions/Standard/StGeomFromWkb.php: -------------------------------------------------------------------------------- 1 | 2017-2025 9 | * Copyright Longitude One 2020-2025 10 | * Copyright 2015 Derek J. Lambert 11 | * 12 | * For the full copyright and license information, please view the LICENSE 13 | * file that was distributed with this source code. 14 | * 15 | */ 16 | 17 | declare(strict_types=1); 18 | 19 | namespace LongitudeOne\Spatial\ORM\Query\AST\Functions\Standard; 20 | 21 | use Doctrine\DBAL\Platforms\AbstractPlatform; 22 | use Doctrine\DBAL\Platforms\MySQLPlatform; 23 | use Doctrine\DBAL\Platforms\PostgreSQLPlatform; 24 | use LongitudeOne\Spatial\ORM\Query\AST\Functions\AbstractSpatialDQLFunction; 25 | 26 | /** 27 | * ST_GeomFromWkb function. 28 | * 29 | * @author Alexandre Tranchant 30 | * @license https://alexandre-tranchant.mit-license.org 31 | */ 32 | class StGeomFromWkb extends AbstractSpatialDQLFunction 33 | { 34 | /** 35 | * Function SQL name getter. 36 | * 37 | * @since 2.0 This function replace the protected property functionName. 38 | */ 39 | protected function getFunctionName(): string 40 | { 41 | return 'ST_GeomFromWKB'; 42 | } 43 | 44 | /** 45 | * Maximum number of parameters for the spatial function. 46 | * 47 | * @since 2.0 This function replace the protected property maxGeomExpr. 48 | * 49 | * @return int the inherited methods shall NOT return null, but 0 when function has no parameter 50 | */ 51 | protected function getMaxParameter(): int 52 | { 53 | return 2; 54 | } 55 | 56 | /** 57 | * Minimum number of parameters for the spatial function. 58 | * 59 | * @since 2.0 This function replace the protected property minGeomExpr. 60 | * 61 | * @return int the inherited methods shall NOT return null, but 0 when function has no parameter 62 | */ 63 | protected function getMinParameter(): int 64 | { 65 | return 1; 66 | } 67 | 68 | /** 69 | * Get the platforms accepted. 70 | * 71 | * @since 2.0 This function replace the protected property platforms. 72 | * @since 5.0 This function returns the class-string[] instead of string[] 73 | * 74 | * @return class-string[] a non-empty array of accepted platforms 75 | */ 76 | protected function getPlatforms(): array 77 | { 78 | return [PostgreSQLPlatform::class, MySQLPlatform::class]; 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /lib/LongitudeOne/Spatial/ORM/Query/AST/Functions/Standard/StPolyFromWkb.php: -------------------------------------------------------------------------------- 1 | 2017-2025 9 | * Copyright Longitude One 2020-2025 10 | * Copyright 2015 Derek J. Lambert 11 | * 12 | * For the full copyright and license information, please view the LICENSE 13 | * file that was distributed with this source code. 14 | * 15 | */ 16 | 17 | declare(strict_types=1); 18 | 19 | namespace LongitudeOne\Spatial\ORM\Query\AST\Functions\Standard; 20 | 21 | use Doctrine\DBAL\Platforms\AbstractPlatform; 22 | use Doctrine\DBAL\Platforms\MySQLPlatform; 23 | use Doctrine\DBAL\Platforms\PostgreSQLPlatform; 24 | use LongitudeOne\Spatial\ORM\Query\AST\Functions\AbstractSpatialDQLFunction; 25 | 26 | /** 27 | * ST_PolyFromWkb function. 28 | * 29 | * @author Alexandre Tranchant 30 | * @license https://alexandre-tranchant.mit-license.org 31 | */ 32 | class StPolyFromWkb extends AbstractSpatialDQLFunction 33 | { 34 | /** 35 | * Function SQL name getter. 36 | * 37 | * @since 2.0 This function replace the protected property functionName. 38 | */ 39 | protected function getFunctionName(): string 40 | { 41 | return 'ST_PolyFromWkb'; 42 | } 43 | 44 | /** 45 | * Maximum number of parameters for the spatial function. 46 | * 47 | * @since 2.0 This function replace the protected property maxGeomExpr. 48 | * 49 | * @return int the inherited methods shall NOT return null, but 0 when function has no parameter 50 | */ 51 | protected function getMaxParameter(): int 52 | { 53 | return 2; 54 | } 55 | 56 | /** 57 | * Minimum number of parameters for the spatial function. 58 | * 59 | * @since 2.0 This function replace the protected property minGeomExpr. 60 | * 61 | * @return int the inherited methods shall NOT return null, but 0 when function has no parameter 62 | */ 63 | protected function getMinParameter(): int 64 | { 65 | return 1; 66 | } 67 | 68 | /** 69 | * Get the platforms accepted. 70 | * 71 | * @since 2.0 This function replace the protected property platforms. 72 | * @since 5.0 This function returns the class-string[] instead of string[] 73 | * 74 | * @return class-string[] a non-empty array of accepted platforms 75 | */ 76 | protected function getPlatforms(): array 77 | { 78 | return [PostgreSQLPlatform::class, MySQLPlatform::class]; 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /lib/LongitudeOne/Spatial/ORM/Query/AST/Functions/MySql/SpMbrTouches.php: -------------------------------------------------------------------------------- 1 | 2017-2025 9 | * Copyright Longitude One 2020-2025 10 | * Copyright 2015 Derek J. Lambert 11 | * 12 | * For the full copyright and license information, please view the LICENSE 13 | * file that was distributed with this source code. 14 | * 15 | */ 16 | 17 | declare(strict_types=1); 18 | 19 | namespace LongitudeOne\Spatial\ORM\Query\AST\Functions\MySql; 20 | 21 | use Doctrine\DBAL\Platforms\AbstractPlatform; 22 | use Doctrine\DBAL\Platforms\MySQLPlatform; 23 | use LongitudeOne\Spatial\ORM\Query\AST\Functions\AbstractSpatialDQLFunction; 24 | 25 | /** 26 | * MBRTouches DQL function 27 | * Whether MBRs of two geometries touch. 28 | * 29 | * @author Mohammad Heydari 30 | * @author Alexandre Tranchant 31 | * @license https://mdhheydari.mit-license.org MIT 32 | */ 33 | class SpMbrTouches extends AbstractSpatialDQLFunction 34 | { 35 | /** 36 | * Function SQL name getter. 37 | * 38 | * @since 2.0 This function replace the protected property functionName. 39 | */ 40 | protected function getFunctionName(): string 41 | { 42 | return 'MBRTouches'; 43 | } 44 | 45 | /** 46 | * Maximum number of parameters for the spatial function. 47 | * 48 | * @since 2.0 This function replace the protected property maxGeomExpr. 49 | * 50 | * @return int the inherited methods shall NOT return null, but 0 when function has no parameter 51 | */ 52 | protected function getMaxParameter(): int 53 | { 54 | return 2; 55 | } 56 | 57 | /** 58 | * Minimum number of parameters for the spatial function. 59 | * 60 | * @since 2.0 This function replace the protected property minGeomExpr. 61 | * 62 | * @return int the inherited methods shall NOT return null, but 0 when function has no parameter 63 | */ 64 | protected function getMinParameter(): int 65 | { 66 | return 2; 67 | } 68 | 69 | /** 70 | * Get the platforms accepted. 71 | * 72 | * @since 2.0 This function replace the protected property platforms. 73 | * @since 5.0 This function returns the class-string[] instead of string[] 74 | * 75 | * @return class-string[] a non-empty array of accepted platforms 76 | */ 77 | protected function getPlatforms(): array 78 | { 79 | return [MySQLPlatform::class]; 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /lib/LongitudeOne/Spatial/ORM/Query/AST/Functions/PostgreSql/SpGeomFromEwkt.php: -------------------------------------------------------------------------------- 1 | 2017-2025 9 | * Copyright Longitude One 2020-2025 10 | * Copyright 2015 Derek J. Lambert 11 | * 12 | * For the full copyright and license information, please view the LICENSE 13 | * file that was distributed with this source code. 14 | * 15 | */ 16 | 17 | declare(strict_types=1); 18 | 19 | namespace LongitudeOne\Spatial\ORM\Query\AST\Functions\PostgreSql; 20 | 21 | use Doctrine\DBAL\Platforms\AbstractPlatform; 22 | use Doctrine\DBAL\Platforms\PostgreSQLPlatform; 23 | use LongitudeOne\Spatial\ORM\Query\AST\Functions\AbstractSpatialDQLFunction; 24 | 25 | /** 26 | * ST_GeomFromEWKT DQL function. 27 | * 28 | * @author Derek J. Lambert 29 | * @author Alexandre Tranchant 30 | * @license https://alexandre-tranchant.mit-license.org 31 | */ 32 | class SpGeomFromEwkt extends AbstractSpatialDQLFunction 33 | { 34 | /** 35 | * Function SQL name getter. 36 | * 37 | * @since 2.0 This function replace the protected property functionName. 38 | */ 39 | protected function getFunctionName(): string 40 | { 41 | return 'ST_GeomFromEWKT'; 42 | } 43 | 44 | /** 45 | * Maximum number of parameter for the spatial function. 46 | * 47 | * @since 2.0 This function replace the protected property maxGeomExpr. 48 | * 49 | * @return int the inherited methods shall NOT return null, but 0 when function has no parameter 50 | */ 51 | protected function getMaxParameter(): int 52 | { 53 | return 2; 54 | } 55 | 56 | /** 57 | * Minimum number of parameter for the spatial function. 58 | * 59 | * @since 2.0 This function replace the protected property minGeomExpr. 60 | * 61 | * @return int the inherited methods shall NOT return null, but 0 when function has no parameter 62 | */ 63 | protected function getMinParameter(): int 64 | { 65 | return 1; 66 | } 67 | 68 | /** 69 | * Get the platforms accepted. 70 | * 71 | * @since 2.0 This function replace the protected property platforms. 72 | * @since 5.0 This function returns the class-string[] instead of string[] 73 | * 74 | * @return class-string[] a non-empty array of accepted platforms 75 | */ 76 | protected function getPlatforms(): array 77 | { 78 | return [PostgreSQLPlatform::class]; 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /lib/LongitudeOne/Spatial/ORM/Query/AST/Functions/Standard/StMLineFromWkb.php: -------------------------------------------------------------------------------- 1 | 2017-2025 9 | * Copyright Longitude One 2020-2025 10 | * Copyright 2015 Derek J. Lambert 11 | * 12 | * For the full copyright and license information, please view the LICENSE 13 | * file that was distributed with this source code. 14 | * 15 | */ 16 | 17 | declare(strict_types=1); 18 | 19 | namespace LongitudeOne\Spatial\ORM\Query\AST\Functions\Standard; 20 | 21 | use Doctrine\DBAL\Platforms\AbstractPlatform; 22 | use Doctrine\DBAL\Platforms\MySQLPlatform; 23 | use Doctrine\DBAL\Platforms\PostgreSQLPlatform; 24 | use LongitudeOne\Spatial\ORM\Query\AST\Functions\AbstractSpatialDQLFunction; 25 | 26 | /** 27 | * ST_MLineFromWkb function. 28 | * 29 | * @author Alexandre Tranchant 30 | * @license https://alexandre-tranchant.mit-license.org 31 | */ 32 | class StMLineFromWkb extends AbstractSpatialDQLFunction 33 | { 34 | /** 35 | * Function SQL name getter. 36 | * 37 | * @since 2.0 This function replace the protected property functionName. 38 | */ 39 | protected function getFunctionName(): string 40 | { 41 | return 'ST_MLineFromWkb'; 42 | } 43 | 44 | /** 45 | * Maximum number of parameter for the spatial function. 46 | * 47 | * @since 2.0 This function replace the protected property maxGeomExpr. 48 | * 49 | * @return int the inherited methods shall NOT return null, but 0 when function has no parameter 50 | */ 51 | protected function getMaxParameter(): int 52 | { 53 | return 2; 54 | } 55 | 56 | /** 57 | * Minimum number of parameter for the spatial function. 58 | * 59 | * @since 2.0 This function replace the protected property minGeomExpr. 60 | * 61 | * @return int the inherited methods shall NOT return null, but 0 when function has no parameter 62 | */ 63 | protected function getMinParameter(): int 64 | { 65 | return 1; 66 | } 67 | 68 | /** 69 | * Get the platforms accepted. 70 | * 71 | * @since 2.0 This function replace the protected property platforms. 72 | * @since 5.0 This function returns the class-string[] instead of string[] 73 | * 74 | * @return class-string[] a non-empty array of accepted platforms 75 | */ 76 | protected function getPlatforms(): array 77 | { 78 | return [PostgreSQLPlatform::class, MySQLPlatform::class]; 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /lib/LongitudeOne/Spatial/ORM/Query/AST/Functions/Standard/StMPolyFromWkb.php: -------------------------------------------------------------------------------- 1 | 2017-2025 9 | * Copyright Longitude One 2020-2025 10 | * Copyright 2015 Derek J. Lambert 11 | * 12 | * For the full copyright and license information, please view the LICENSE 13 | * file that was distributed with this source code. 14 | * 15 | */ 16 | 17 | declare(strict_types=1); 18 | 19 | namespace LongitudeOne\Spatial\ORM\Query\AST\Functions\Standard; 20 | 21 | use Doctrine\DBAL\Platforms\AbstractPlatform; 22 | use Doctrine\DBAL\Platforms\MySQLPlatform; 23 | use Doctrine\DBAL\Platforms\PostgreSQLPlatform; 24 | use LongitudeOne\Spatial\ORM\Query\AST\Functions\AbstractSpatialDQLFunction; 25 | 26 | /** 27 | * ST_MPolyFromWkb function. 28 | * 29 | * @author Alexandre Tranchant 30 | * @license https://alexandre-tranchant.mit-license.org 31 | */ 32 | class StMPolyFromWkb extends AbstractSpatialDQLFunction 33 | { 34 | /** 35 | * Function SQL name getter. 36 | * 37 | * @since 2.0 This function replace the protected property functionName. 38 | */ 39 | protected function getFunctionName(): string 40 | { 41 | return 'ST_MPolyFromWkb'; 42 | } 43 | 44 | /** 45 | * Maximum number of parameters for the spatial function. 46 | * 47 | * @since 2.0 This function replace the protected property maxGeomExpr. 48 | * 49 | * @return int the inherited methods shall NOT return null, but 0 when function has no parameter 50 | */ 51 | protected function getMaxParameter(): int 52 | { 53 | return 2; 54 | } 55 | 56 | /** 57 | * Minimum number of parameters for the spatial function. 58 | * 59 | * @since 2.0 This function replace the protected property minGeomExpr. 60 | * 61 | * @return int the inherited methods shall NOT return null, but 0 when function has no parameter 62 | */ 63 | protected function getMinParameter(): int 64 | { 65 | return 1; 66 | } 67 | 68 | /** 69 | * Get the platforms accepted. 70 | * 71 | * @since 2.0 This function replace the protected property platforms. 72 | * @since 5.0 This function returns the class-string[] instead of string[] 73 | * 74 | * @return class-string[] a non-empty array of accepted platforms 75 | */ 76 | protected function getPlatforms(): array 77 | { 78 | return [PostgreSQLPlatform::class, MySQLPlatform::class]; 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /lib/LongitudeOne/Spatial/ORM/Query/AST/Functions/Standard/StPointFromWkb.php: -------------------------------------------------------------------------------- 1 | 2017-2025 9 | * Copyright Longitude One 2020-2025 10 | * Copyright 2015 Derek J. Lambert 11 | * 12 | * For the full copyright and license information, please view the LICENSE 13 | * file that was distributed with this source code. 14 | * 15 | */ 16 | 17 | declare(strict_types=1); 18 | 19 | namespace LongitudeOne\Spatial\ORM\Query\AST\Functions\Standard; 20 | 21 | use Doctrine\DBAL\Platforms\AbstractPlatform; 22 | use Doctrine\DBAL\Platforms\MySQLPlatform; 23 | use Doctrine\DBAL\Platforms\PostgreSQLPlatform; 24 | use LongitudeOne\Spatial\ORM\Query\AST\Functions\AbstractSpatialDQLFunction; 25 | 26 | /** 27 | * ST_PointFromWKB function. 28 | * 29 | * @author Alexandre Tranchant 30 | * @license https://alexandre-tranchant.mit-license.org 31 | */ 32 | class StPointFromWkb extends AbstractSpatialDQLFunction 33 | { 34 | /** 35 | * Function SQL name getter. 36 | * 37 | * @since 2.0 This function replace the protected property functionName. 38 | */ 39 | protected function getFunctionName(): string 40 | { 41 | return 'ST_PointFromWKB'; 42 | } 43 | 44 | /** 45 | * Maximum number of parameters for the spatial function. 46 | * 47 | * @since 2.0 This function replace the protected property maxGeomExpr. 48 | * 49 | * @return int the inherited methods shall NOT return null, but 0 when function has no parameter 50 | */ 51 | protected function getMaxParameter(): int 52 | { 53 | return 2; 54 | } 55 | 56 | /** 57 | * Minimum number of parameters for the spatial function. 58 | * 59 | * @since 2.0 This function replace the protected property minGeomExpr. 60 | * 61 | * @return int the inherited methods shall NOT return null, but 0 when function has no parameter 62 | */ 63 | protected function getMinParameter(): int 64 | { 65 | return 1; 66 | } 67 | 68 | /** 69 | * Get the platforms accepted. 70 | * 71 | * @since 2.0 This function replace the protected property platforms. 72 | * @since 5.0 This function returns the class-string[] instead of string[] 73 | * 74 | * @return class-string[] a non-empty array of accepted platforms 75 | */ 76 | protected function getPlatforms(): array 77 | { 78 | return [PostgreSQLPlatform::class, MySQLPlatform::class]; 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /lib/LongitudeOne/Spatial/ORM/Query/AST/Functions/PostgreSql/SpContainsProperly.php: -------------------------------------------------------------------------------- 1 | 2017-2025 9 | * Copyright Longitude One 2020-2025 10 | * Copyright 2015 Derek J. Lambert 11 | * 12 | * For the full copyright and license information, please view the LICENSE 13 | * file that was distributed with this source code. 14 | * 15 | */ 16 | 17 | declare(strict_types=1); 18 | 19 | namespace LongitudeOne\Spatial\ORM\Query\AST\Functions\PostgreSql; 20 | 21 | use Doctrine\DBAL\Platforms\AbstractPlatform; 22 | use Doctrine\DBAL\Platforms\PostgreSQLPlatform; 23 | use LongitudeOne\Spatial\ORM\Query\AST\Functions\AbstractSpatialDQLFunction; 24 | 25 | /** 26 | * ST_ContainsProperly DQL function. 27 | * 28 | * @author Derek J. Lambert 29 | * @author Alexandre Tranchant 30 | * @license https://dlambert.mit-license.org MIT 31 | */ 32 | class SpContainsProperly extends AbstractSpatialDQLFunction 33 | { 34 | /** 35 | * Function SQL name getter. 36 | * 37 | * @since 2.0 This function replace the protected property functionName. 38 | */ 39 | protected function getFunctionName(): string 40 | { 41 | return 'ST_ContainsProperly'; 42 | } 43 | 44 | /** 45 | * Maximum number of parameter for the spatial function. 46 | * 47 | * @since 2.0 This function replace the protected property maxGeomExpr. 48 | * 49 | * @return int the inherited methods shall NOT return null, but 0 when function has no parameter 50 | */ 51 | protected function getMaxParameter(): int 52 | { 53 | return 2; 54 | } 55 | 56 | /** 57 | * Minimum number of parameter for the spatial function. 58 | * 59 | * @since 2.0 This function replace the protected property minGeomExpr. 60 | * 61 | * @return int the inherited methods shall NOT return null, but 0 when function has no parameter 62 | */ 63 | protected function getMinParameter(): int 64 | { 65 | return 2; 66 | } 67 | 68 | /** 69 | * Get the platforms accepted. 70 | * 71 | * @since 2.0 This function replace the protected property platforms. 72 | * @since 5.0 This function returns the class-string[] instead of string[] 73 | * 74 | * @return class-string[] a non-empty array of accepted platforms 75 | */ 76 | protected function getPlatforms(): array 77 | { 78 | return [PostgreSQLPlatform::class]; 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /lib/LongitudeOne/Spatial/ORM/Query/AST/Functions/Standard/StMPointFromWkb.php: -------------------------------------------------------------------------------- 1 | 2017-2025 9 | * Copyright Longitude One 2020-2025 10 | * Copyright 2015 Derek J. Lambert 11 | * 12 | * For the full copyright and license information, please view the LICENSE 13 | * file that was distributed with this source code. 14 | * 15 | */ 16 | 17 | declare(strict_types=1); 18 | 19 | namespace LongitudeOne\Spatial\ORM\Query\AST\Functions\Standard; 20 | 21 | use Doctrine\DBAL\Platforms\AbstractPlatform; 22 | use Doctrine\DBAL\Platforms\MySQLPlatform; 23 | use Doctrine\DBAL\Platforms\PostgreSQLPlatform; 24 | use LongitudeOne\Spatial\ORM\Query\AST\Functions\AbstractSpatialDQLFunction; 25 | 26 | /** 27 | * ST_MPointFromWkb function. 28 | * 29 | * @author Alexandre Tranchant 30 | * @license https://alexandre-tranchant.mit-license.org 31 | */ 32 | class StMPointFromWkb extends AbstractSpatialDQLFunction 33 | { 34 | /** 35 | * Function SQL name getter. 36 | * 37 | * @since 2.0 This function replace the protected property functionName. 38 | */ 39 | protected function getFunctionName(): string 40 | { 41 | return 'ST_MPointFromWkb'; 42 | } 43 | 44 | /** 45 | * Maximum number of parameters for the spatial function. 46 | * 47 | * @since 2.0 This function replace the protected property maxGeomExpr. 48 | * 49 | * @return int the inherited methods shall NOT return null, but 0 when function has no parameter 50 | */ 51 | protected function getMaxParameter(): int 52 | { 53 | return 2; 54 | } 55 | 56 | /** 57 | * Minimum number of parameter for the spatial function. 58 | * 59 | * @since 2.0 This function replace the protected property minGeomExpr. 60 | * 61 | * @return int the inherited methods shall NOT return null, but 0 when function has no parameter 62 | */ 63 | protected function getMinParameter(): int 64 | { 65 | return 1; 66 | } 67 | 68 | /** 69 | * Get the platforms accepted. 70 | * 71 | * @since 2.0 This function replace the protected property platforms. 72 | * @since 5.0 This function returns the class-string[] instead of string[] 73 | * 74 | * @return class-string[] a non-empty array of accepted platforms 75 | */ 76 | protected function getPlatforms(): array 77 | { 78 | return [PostgreSQLPlatform::class, MySQLPlatform::class]; 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /lib/LongitudeOne/Spatial/ORM/Query/AST/Functions/MariaDB/SpMbrTouches.php: -------------------------------------------------------------------------------- 1 | 2017-2025 9 | * Copyright Longitude One 2020-2025 10 | * Copyright 2015 Derek J. Lambert 11 | * 12 | * For the full copyright and license information, please view the LICENSE 13 | * file that was distributed with this source code. 14 | * 15 | */ 16 | 17 | declare(strict_types=1); 18 | 19 | namespace LongitudeOne\Spatial\ORM\Query\AST\Functions\MariaDB; 20 | 21 | use Doctrine\DBAL\Platforms\AbstractPlatform; 22 | use Doctrine\DBAL\Platforms\MariaDBPlatform; 23 | use LongitudeOne\Spatial\ORM\Query\AST\Functions\AbstractSpatialDQLFunction; 24 | 25 | /** 26 | * MBRTouches DQL function 27 | * Whether MBRs of two geometries touch. 28 | * 29 | * @author Mohammad Heydari 30 | * @author Alexandre Tranchant 31 | * @license https://mdhheydari.mit-license.org MIT 32 | */ 33 | class SpMbrTouches extends AbstractSpatialDQLFunction 34 | { 35 | /** 36 | * Function SQL name getter. 37 | * 38 | * @since 2.0 This function replace the protected property functionName. 39 | */ 40 | protected function getFunctionName(): string 41 | { 42 | return 'MBRTouches'; 43 | } 44 | 45 | /** 46 | * Maximum number of parameters for the spatial function. 47 | * 48 | * @since 2.0 This function replace the protected property maxGeomExpr. 49 | * 50 | * @return int the inherited methods shall NOT return null, but 0 when function has no parameter 51 | */ 52 | protected function getMaxParameter(): int 53 | { 54 | return 2; 55 | } 56 | 57 | /** 58 | * Minimum number of parameters for the spatial function. 59 | * 60 | * @since 2.0 This function replace the protected property minGeomExpr. 61 | * 62 | * @return int the inherited methods shall NOT return null, but 0 when function has no parameter 63 | */ 64 | protected function getMinParameter(): int 65 | { 66 | return 2; 67 | } 68 | 69 | /** 70 | * Get the platforms accepted. 71 | * 72 | * @since 2.0 This function replace the protected property platforms. 73 | * @since 5.0 This function returns the class-string[] instead of string[] 74 | * 75 | * @return class-string[] a non-empty array of accepted platforms 76 | */ 77 | protected function getPlatforms(): array 78 | { 79 | return [MariaDBPlatform::class]; 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /lib/LongitudeOne/Spatial/ORM/Query/AST/Functions/Common/ScSrid.php: -------------------------------------------------------------------------------- 1 | 2017-2025 9 | * Copyright Longitude One 2020-2025 10 | * Copyright 2015 Derek J. Lambert 11 | * 12 | * For the full copyright and license information, please view the LICENSE 13 | * file that was distributed with this source code. 14 | * 15 | */ 16 | 17 | declare(strict_types=1); 18 | 19 | namespace LongitudeOne\Spatial\ORM\Query\AST\Functions\Common; 20 | 21 | use Doctrine\DBAL\Platforms\AbstractPlatform; 22 | use Doctrine\DBAL\Platforms\MariaDBPlatform; 23 | use Doctrine\DBAL\Platforms\PostgreSQLPlatform; 24 | use LongitudeOne\Spatial\ORM\Query\AST\Functions\AbstractSpatialDQLFunction; 25 | 26 | /** 27 | * ST_SRID DQL function. 28 | * 29 | * @author Alexandre Tranchant 30 | * @license https://alexandre-tranchant.mit-license.org MIT 31 | */ 32 | class ScSrid extends AbstractSpatialDQLFunction 33 | { 34 | /** 35 | * Function SQL name getter. 36 | */ 37 | protected function getFunctionName(): string 38 | { 39 | return 'ST_SRID'; 40 | } 41 | 42 | /** 43 | * Maximum number of parameters for the spatial function. 44 | * 45 | * Be careful, this function is different from the standard function. 46 | * PostgreSQL and MariaDB do NOT respect the standard. The ST_SRID function has only one parameter. 47 | * So we created this common function. If you're looking for the standard function, please use Standard/SpSrid. 48 | * 49 | * @return int the inherited methods shall NOT return null, but 0 when function has no parameter 50 | */ 51 | protected function getMaxParameter(): int 52 | { 53 | return 1; 54 | } 55 | 56 | /** 57 | * Minimum number of parameters for the spatial function. 58 | * 59 | * @return int the inherited methods shall NOT return null, but 0 when function has no parameter 60 | */ 61 | protected function getMinParameter(): int 62 | { 63 | return 1; 64 | } 65 | 66 | /** 67 | * Get the platforms accepted. 68 | * 69 | * @since 2.0 This function replace the protected property platforms. 70 | * @since 5.0 This function returns the class-string[] instead of string[] 71 | * 72 | * @return class-string[] a non-empty array of accepted platforms 73 | */ 74 | protected function getPlatforms(): array 75 | { 76 | return [PostgreSQLPlatform::class, MariaDBPlatform::class]; 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /lib/LongitudeOne/Spatial/ORM/Query/AST/Functions/MySql/SpMbrWithin.php: -------------------------------------------------------------------------------- 1 | 2017-2025 9 | * Copyright Longitude One 2020-2025 10 | * Copyright 2015 Derek J. Lambert 11 | * 12 | * For the full copyright and license information, please view the LICENSE 13 | * file that was distributed with this source code. 14 | * 15 | */ 16 | 17 | declare(strict_types=1); 18 | 19 | namespace LongitudeOne\Spatial\ORM\Query\AST\Functions\MySql; 20 | 21 | use Doctrine\DBAL\Platforms\AbstractPlatform; 22 | use Doctrine\DBAL\Platforms\MySQLPlatform; 23 | use LongitudeOne\Spatial\ORM\Query\AST\Functions\AbstractSpatialDQLFunction; 24 | 25 | /** 26 | * MBRWithin DQL function 27 | * Whether MBR of one geometry is within MBR of another. 28 | * 29 | * @author Mohammad Heydari 30 | * @author Alexandre Tranchant 31 | * @license https://mdhheydari.mit-license.org MIT 32 | */ 33 | class SpMbrWithin extends AbstractSpatialDQLFunction 34 | { 35 | /** 36 | * Function SQL name getter. 37 | * 38 | * @since 2.0 This function replace the protected property functionName. 39 | */ 40 | protected function getFunctionName(): string 41 | { 42 | return 'MBRWithin'; 43 | } 44 | 45 | /** 46 | * Maximum number of parameters for the spatial function. 47 | * 48 | * @since 2.0 This function replace the protected property maxGeomExpr. 49 | * 50 | * @return int the inherited methods shall NOT return null, but 0 when function has no parameter 51 | */ 52 | protected function getMaxParameter(): int 53 | { 54 | return 2; 55 | } 56 | 57 | /** 58 | * Minimum number of parameters for the spatial function. 59 | * 60 | * @since 2.0 This function replace the protected property minGeomExpr. 61 | * 62 | * @return int the inherited methods shall NOT return null, but 0 when function has no parameter 63 | */ 64 | protected function getMinParameter(): int 65 | { 66 | return 2; 67 | } 68 | 69 | /** 70 | * Get the platforms accepted. 71 | * 72 | * @since 2.0 This function replace the protected property platforms. 73 | * @since 5.0 This function returns the class-string[] instead of string[] 74 | * 75 | * @return class-string[] a non-empty array of accepted platforms 76 | */ 77 | protected function getPlatforms(): array 78 | { 79 | return [MySQLPlatform::class]; 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /lib/LongitudeOne/Spatial/ORM/Query/AST/Functions/Standard/StLineStringFromWkb.php: -------------------------------------------------------------------------------- 1 | 2017-2025 9 | * Copyright Longitude One 2020-2025 10 | * Copyright 2015 Derek J. Lambert 11 | * 12 | * For the full copyright and license information, please view the LICENSE 13 | * file that was distributed with this source code. 14 | * 15 | */ 16 | 17 | declare(strict_types=1); 18 | 19 | namespace LongitudeOne\Spatial\ORM\Query\AST\Functions\Standard; 20 | 21 | use Doctrine\DBAL\Platforms\AbstractPlatform; 22 | use Doctrine\DBAL\Platforms\MySQLPlatform; 23 | use Doctrine\DBAL\Platforms\PostgreSQLPlatform; 24 | use LongitudeOne\Spatial\ORM\Query\AST\Functions\AbstractSpatialDQLFunction; 25 | 26 | /** 27 | * LineStringFromWKB function. 28 | * 29 | * @author Alexandre Tranchant 30 | * @license https://alexandre-tranchant.mit-license.org 31 | */ 32 | class StLineStringFromWkb extends AbstractSpatialDQLFunction 33 | { 34 | /** 35 | * Function SQL name getter. 36 | * 37 | * @since 2.0 This function replace the protected property functionName. 38 | */ 39 | protected function getFunctionName(): string 40 | { 41 | return 'ST_LineStringFromWKB'; 42 | } 43 | 44 | /** 45 | * Maximum number of parameters for the spatial function. 46 | * 47 | * @since 2.0 This function replace the protected property maxGeomExpr. 48 | * 49 | * @return int the inherited methods shall NOT return null, but 0 when function has no parameter 50 | */ 51 | protected function getMaxParameter(): int 52 | { 53 | return 2; 54 | } 55 | 56 | /** 57 | * Minimum number of parameters for the spatial function. 58 | * 59 | * @since 2.0 This function replace the protected property minGeomExpr. 60 | * 61 | * @return int the inherited methods shall NOT return null, but 0 when function has no parameter 62 | */ 63 | protected function getMinParameter(): int 64 | { 65 | return 1; 66 | } 67 | 68 | /** 69 | * Get the platforms accepted. 70 | * 71 | * @since 2.0 This function replace the protected property platforms. 72 | * @since 5.0 This function returns the class-string[] instead of string[] 73 | * 74 | * @return class-string[] a non-empty array of accepted platforms 75 | */ 76 | protected function getPlatforms(): array 77 | { 78 | return [PostgreSQLPlatform::class, MySQLPlatform::class]; 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /lib/LongitudeOne/Spatial/ORM/Query/AST/Functions/MariaDB/SpMbrWithin.php: -------------------------------------------------------------------------------- 1 | 2017-2025 9 | * Copyright Longitude One 2020-2025 10 | * Copyright 2015 Derek J. Lambert 11 | * 12 | * For the full copyright and license information, please view the LICENSE 13 | * file that was distributed with this source code. 14 | * 15 | */ 16 | 17 | declare(strict_types=1); 18 | 19 | namespace LongitudeOne\Spatial\ORM\Query\AST\Functions\MariaDB; 20 | 21 | use Doctrine\DBAL\Platforms\AbstractPlatform; 22 | use Doctrine\DBAL\Platforms\MariaDBPlatform; 23 | use LongitudeOne\Spatial\ORM\Query\AST\Functions\AbstractSpatialDQLFunction; 24 | 25 | /** 26 | * MBRWithin DQL function 27 | * Whether MBR of one geometry is within MBR of another. 28 | * 29 | * @author Mohammad Heydari 30 | * @author Alexandre Tranchant 31 | * @license https://mdhheydari.mit-license.org MIT 32 | */ 33 | class SpMbrWithin extends AbstractSpatialDQLFunction 34 | { 35 | /** 36 | * Function SQL name getter. 37 | * 38 | * @since 2.0 This function replace the protected property functionName. 39 | */ 40 | protected function getFunctionName(): string 41 | { 42 | return 'MBRWithin'; 43 | } 44 | 45 | /** 46 | * Maximum number of parameters for the spatial function. 47 | * 48 | * @since 2.0 This function replace the protected property maxGeomExpr. 49 | * 50 | * @return int the inherited methods shall NOT return null, but 0 when function has no parameter 51 | */ 52 | protected function getMaxParameter(): int 53 | { 54 | return 2; 55 | } 56 | 57 | /** 58 | * Minimum number of parameters for the spatial function. 59 | * 60 | * @since 2.0 This function replace the protected property minGeomExpr. 61 | * 62 | * @return int the inherited methods shall NOT return null, but 0 when function has no parameter 63 | */ 64 | protected function getMinParameter(): int 65 | { 66 | return 2; 67 | } 68 | 69 | /** 70 | * Get the platforms accepted. 71 | * 72 | * @since 2.0 This function replace the protected property platforms. 73 | * @since 5.0 This function returns the class-string[] instead of string[] 74 | * 75 | * @return class-string[] a non-empty array of accepted platforms 76 | */ 77 | protected function getPlatforms(): array 78 | { 79 | return [MariaDBPlatform::class]; 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /lib/LongitudeOne/Spatial/ORM/Query/AST/Functions/MySql/SpMbrIntersects.php: -------------------------------------------------------------------------------- 1 | 2017-2025 9 | * Copyright Longitude One 2020-2025 10 | * Copyright 2015 Derek J. Lambert 11 | * 12 | * For the full copyright and license information, please view the LICENSE 13 | * file that was distributed with this source code. 14 | * 15 | */ 16 | 17 | declare(strict_types=1); 18 | 19 | namespace LongitudeOne\Spatial\ORM\Query\AST\Functions\MySql; 20 | 21 | use Doctrine\DBAL\Platforms\AbstractPlatform; 22 | use Doctrine\DBAL\Platforms\MySQLPlatform; 23 | use LongitudeOne\Spatial\ORM\Query\AST\Functions\AbstractSpatialDQLFunction; 24 | 25 | /** 26 | * MBRIntersects DQL function 27 | * Whether MBRs of two geometries intersect. 28 | * 29 | * @author Mohammad Heydari 30 | * @author Alexandre Tranchant 31 | * @license https://mdhheydari.mit-license.org MIT 32 | */ 33 | class SpMbrIntersects extends AbstractSpatialDQLFunction 34 | { 35 | /** 36 | * Function SQL name getter. 37 | * 38 | * @since 2.0 This function replace the protected property functionName. 39 | */ 40 | protected function getFunctionName(): string 41 | { 42 | return 'MBRIntersects'; 43 | } 44 | 45 | /** 46 | * Maximum number of parameters for the spatial function. 47 | * 48 | * @since 2.0 This function replace the protected property maxGeomExpr. 49 | * 50 | * @return int the inherited methods shall NOT return null, but 0 when function has no parameter 51 | */ 52 | protected function getMaxParameter(): int 53 | { 54 | return 2; 55 | } 56 | 57 | /** 58 | * Minimum number of parameters for the spatial function. 59 | * 60 | * @since 2.0 This function replace the protected property minGeomExpr. 61 | * 62 | * @return int the inherited methods shall NOT return null, but 0 when function has no parameter 63 | */ 64 | protected function getMinParameter(): int 65 | { 66 | return 2; 67 | } 68 | 69 | /** 70 | * Get the platforms accepted. 71 | * 72 | * @since 2.0 This function replace the protected property platforms. 73 | * @since 5.0 This function returns the class-string[] instead of string[] 74 | * 75 | * @return class-string[] a non-empty array of accepted platforms 76 | */ 77 | protected function getPlatforms(): array 78 | { 79 | return [MySQLPlatform::class]; 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /lib/LongitudeOne/Spatial/ORM/Query/AST/Functions/Standard/StNumInteriorRing.php: -------------------------------------------------------------------------------- 1 | 2017-2025 9 | * Copyright Longitude One 2020-2025 10 | * Copyright 2015 Derek J. Lambert 11 | * 12 | * For the full copyright and license information, please view the LICENSE 13 | * file that was distributed with this source code. 14 | * 15 | */ 16 | 17 | declare(strict_types=1); 18 | 19 | namespace LongitudeOne\Spatial\ORM\Query\AST\Functions\Standard; 20 | 21 | use Doctrine\DBAL\Platforms\AbstractPlatform; 22 | use Doctrine\DBAL\Platforms\MySQLPlatform; 23 | use Doctrine\DBAL\Platforms\PostgreSQLPlatform; 24 | use LongitudeOne\Spatial\ORM\Query\AST\Functions\AbstractSpatialDQLFunction; 25 | 26 | /** 27 | * ST_NumInteriorRing DQL function. 28 | * 29 | * @author Alexandre Tranchant 30 | * @license https://alexandre-tranchant.mit-license.org MIT 31 | */ 32 | class StNumInteriorRing extends AbstractSpatialDQLFunction 33 | { 34 | /** 35 | * Function SQL name getter. 36 | * 37 | * @since 2.0 This function replace the protected property functionName. 38 | */ 39 | protected function getFunctionName(): string 40 | { 41 | return 'ST_NumInteriorRing'; 42 | } 43 | 44 | /** 45 | * Maximum number of parameters for the spatial function. 46 | * 47 | * @since 2.0 This function replace the protected property maxGeomExpr. 48 | * 49 | * @return int the inherited methods shall NOT return null, but 0 when function has no parameter 50 | */ 51 | protected function getMaxParameter(): int 52 | { 53 | return 1; 54 | } 55 | 56 | /** 57 | * Minimum number of parameters for the spatial function. 58 | * 59 | * @since 2.0 This function replace the protected property minGeomExpr. 60 | * 61 | * @return int the inherited methods shall NOT return null, but 0 when function has no parameter 62 | */ 63 | protected function getMinParameter(): int 64 | { 65 | return 1; 66 | } 67 | 68 | /** 69 | * Get the platforms accepted. 70 | * 71 | * @since 2.0 This function replace the protected property platforms. 72 | * @since 5.0 This function returns the class-string[] instead of string[] 73 | * 74 | * @return class-string[] a non-empty array of accepted platforms 75 | */ 76 | protected function getPlatforms(): array 77 | { 78 | return [PostgreSQLPlatform::class, MySQLPlatform::class]; 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /lib/LongitudeOne/Spatial/ORM/Query/AST/Functions/MariaDB/SpMbrIntersects.php: -------------------------------------------------------------------------------- 1 | 2017-2025 9 | * Copyright Longitude One 2020-2025 10 | * Copyright 2015 Derek J. Lambert 11 | * 12 | * For the full copyright and license information, please view the LICENSE 13 | * file that was distributed with this source code. 14 | * 15 | */ 16 | 17 | declare(strict_types=1); 18 | 19 | namespace LongitudeOne\Spatial\ORM\Query\AST\Functions\MariaDB; 20 | 21 | use Doctrine\DBAL\Platforms\AbstractPlatform; 22 | use Doctrine\DBAL\Platforms\MariaDBPlatform; 23 | use LongitudeOne\Spatial\ORM\Query\AST\Functions\AbstractSpatialDQLFunction; 24 | 25 | /** 26 | * MBRIntersects DQL function 27 | * Whether MBRs of two geometries intersect. 28 | * 29 | * @author Mohammad Heydari 30 | * @author Alexandre Tranchant 31 | * @license https://mdhheydari.mit-license.org MIT 32 | */ 33 | class SpMbrIntersects extends AbstractSpatialDQLFunction 34 | { 35 | /** 36 | * Function SQL name getter. 37 | * 38 | * @since 2.0 This function replace the protected property functionName. 39 | */ 40 | protected function getFunctionName(): string 41 | { 42 | return 'MBRIntersects'; 43 | } 44 | 45 | /** 46 | * Maximum number of parameters for the spatial function. 47 | * 48 | * @since 2.0 This function replace the protected property maxGeomExpr. 49 | * 50 | * @return int the inherited methods shall NOT return null, but 0 when function has no parameter 51 | */ 52 | protected function getMaxParameter(): int 53 | { 54 | return 2; 55 | } 56 | 57 | /** 58 | * Minimum number of parameters for the spatial function. 59 | * 60 | * @since 2.0 This function replace the protected property minGeomExpr. 61 | * 62 | * @return int the inherited methods shall NOT return null, but 0 when function has no parameter 63 | */ 64 | protected function getMinParameter(): int 65 | { 66 | return 2; 67 | } 68 | 69 | /** 70 | * Get the platforms accepted. 71 | * 72 | * @since 2.0 This function replace the protected property platforms. 73 | * @since 5.0 This function returns the class-string[] instead of string[] 74 | * 75 | * @return class-string[] a non-empty array of accepted platforms 76 | */ 77 | protected function getPlatforms(): array 78 | { 79 | return [MariaDBPlatform::class]; 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /lib/LongitudeOne/Spatial/ORM/Query/AST/Functions/PostgreSql/SpLineCrossingDirection.php: -------------------------------------------------------------------------------- 1 | 2017-2025 9 | * Copyright Longitude One 2020-2025 10 | * Copyright 2015 Derek J. Lambert 11 | * 12 | * For the full copyright and license information, please view the LICENSE 13 | * file that was distributed with this source code. 14 | * 15 | */ 16 | 17 | declare(strict_types=1); 18 | 19 | namespace LongitudeOne\Spatial\ORM\Query\AST\Functions\PostgreSql; 20 | 21 | use Doctrine\DBAL\Platforms\AbstractPlatform; 22 | use Doctrine\DBAL\Platforms\PostgreSQLPlatform; 23 | use LongitudeOne\Spatial\ORM\Query\AST\Functions\AbstractSpatialDQLFunction; 24 | 25 | /** 26 | * ST_LineCrossingDirection DQL function. 27 | * 28 | * @author Derek J. Lambert 29 | * @author Alexandre Tranchant 30 | * @license https://dlambert.mit-license.org MIT 31 | */ 32 | class SpLineCrossingDirection extends AbstractSpatialDQLFunction 33 | { 34 | /** 35 | * Function SQL name getter. 36 | * 37 | * @since 2.0 This function replace the protected property functionName. 38 | */ 39 | protected function getFunctionName(): string 40 | { 41 | return 'ST_LineCrossingDirection'; 42 | } 43 | 44 | /** 45 | * Maximum number of parameter for the spatial function. 46 | * 47 | * @since 2.0 This function replace the protected property maxGeomExpr. 48 | * 49 | * @return int the inherited methods shall NOT return null, but 0 when function has no parameter 50 | */ 51 | protected function getMaxParameter(): int 52 | { 53 | return 2; 54 | } 55 | 56 | /** 57 | * Minimum number of parameter for the spatial function. 58 | * 59 | * @since 2.0 This function replace the protected property minGeomExpr. 60 | * 61 | * @return int the inherited methods shall NOT return null, but 0 when function has no parameter 62 | */ 63 | protected function getMinParameter(): int 64 | { 65 | return 2; 66 | } 67 | 68 | /** 69 | * Get the platforms accepted. 70 | * 71 | * @since 2.0 This function replace the protected property platforms. 72 | * @since 5.0 This function returns the class-string[] instead of string[] 73 | * 74 | * @return class-string[] a non-empty array of accepted platforms 75 | */ 76 | protected function getPlatforms(): array 77 | { 78 | return [PostgreSQLPlatform::class]; 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /lib/LongitudeOne/Spatial/ORM/Query/AST/Functions/PostgreSql/SpNPoints.php: -------------------------------------------------------------------------------- 1 | 2017-2025 9 | * Copyright Longitude One 2020-2025 10 | * Copyright 2015 Derek J. Lambert 11 | * 12 | * For the full copyright and license information, please view the LICENSE 13 | * file that was distributed with this source code. 14 | * 15 | */ 16 | 17 | declare(strict_types=1); 18 | 19 | namespace LongitudeOne\Spatial\ORM\Query\AST\Functions\PostgreSql; 20 | 21 | use Doctrine\DBAL\Platforms\AbstractPlatform; 22 | use Doctrine\DBAL\Platforms\PostgreSQLPlatform; 23 | use LongitudeOne\Spatial\ORM\Query\AST\Functions\AbstractSpatialDQLFunction; 24 | 25 | /** 26 | * SP_NPoints DQL function. 27 | * This function is equivalent to the OGC Standard SP_NumPoints function, but it accepts all geometries. 28 | * 29 | * @author Alexandre Tranchant 30 | * @license https://alexandre-tranchant.mit-license.org 31 | */ 32 | class SpNPoints extends AbstractSpatialDQLFunction 33 | { 34 | /** 35 | * Function SQL name getter. 36 | * 37 | * @since 2.0 This function replace the protected property functionName. 38 | */ 39 | protected function getFunctionName(): string 40 | { 41 | return 'ST_NPoints'; 42 | } 43 | 44 | /** 45 | * Maximum number of parameter for the spatial function. 46 | * 47 | * @since 2.0 This function replace the protected property maxGeomExpr. 48 | * 49 | * @return int the inherited methods shall NOT return null, but 0 when function has no parameter 50 | */ 51 | protected function getMaxParameter(): int 52 | { 53 | return 1; 54 | } 55 | 56 | /** 57 | * Minimum number of parameter for the spatial function. 58 | * 59 | * @since 2.0 This function replace the protected property minGeomExpr. 60 | * 61 | * @return int the inherited methods shall NOT return null, but 0 when function has no parameter 62 | */ 63 | protected function getMinParameter(): int 64 | { 65 | return 1; 66 | } 67 | 68 | /** 69 | * Get the platforms accepted. 70 | * 71 | * @since 2.0 This function replace the protected property platforms. 72 | * @since 5.0 This function returns the class-string[] instead of string[] 73 | * 74 | * @return class-string[] a non-empty array of accepted platforms 75 | */ 76 | protected function getPlatforms(): array 77 | { 78 | return [PostgreSQLPlatform::class]; 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /lib/LongitudeOne/Spatial/ORM/Query/AST/Functions/MySql/SpBufferStrategy.php: -------------------------------------------------------------------------------- 1 | 2017-2025 9 | * Copyright Longitude One 2020-2025 10 | * Copyright 2015 Derek J. Lambert 11 | * 12 | * For the full copyright and license information, please view the LICENSE 13 | * file that was distributed with this source code. 14 | * 15 | */ 16 | 17 | declare(strict_types=1); 18 | 19 | namespace LongitudeOne\Spatial\ORM\Query\AST\Functions\MySql; 20 | 21 | use Doctrine\DBAL\Platforms\AbstractPlatform; 22 | use Doctrine\DBAL\Platforms\MySQLPlatform; 23 | use LongitudeOne\Spatial\ORM\Query\AST\Functions\AbstractSpatialDQLFunction; 24 | 25 | /** 26 | * Sp_BufferStrategy DQL function. 27 | * MySQL ST_Buffer_Strategy function begins with ST, but is not referenced by OGC Standards. 28 | * 29 | * @author Alexandre Tranchant 30 | * @license https://alexandre-tranchant.mit-license.org MIT 31 | */ 32 | class SpBufferStrategy extends AbstractSpatialDQLFunction 33 | { 34 | /** 35 | * Function SQL name getter. 36 | * 37 | * @since 2.0 This function replace the protected property functionName. 38 | */ 39 | protected function getFunctionName(): string 40 | { 41 | return 'ST_Buffer_Strategy'; 42 | } 43 | 44 | /** 45 | * Maximum number of parameters for the spatial function. 46 | * 47 | * @since 2.0 This function replace the protected property maxGeomExpr. 48 | * 49 | * @return int the inherited methods shall NOT return null, but 0 when function has no parameter 50 | */ 51 | protected function getMaxParameter(): int 52 | { 53 | return 1; 54 | } 55 | 56 | /** 57 | * Minimum number of parameters for the spatial function. 58 | * 59 | * @since 2.0 This function replace the protected property minGeomExpr. 60 | * 61 | * @return int the inherited methods shall NOT return null, but 0 when function has no parameter 62 | */ 63 | protected function getMinParameter(): int 64 | { 65 | return 1; 66 | } 67 | 68 | /** 69 | * Get the platforms accepted. 70 | * 71 | * @since 2.0 This function replace the protected property platforms. 72 | * @since 5.0 This function returns the class-string[] instead of string[] 73 | * 74 | * @return class-string[] a non-empty array of accepted platforms 75 | */ 76 | protected function getPlatforms(): array 77 | { 78 | return [MySQLPlatform::class]; 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /lib/LongitudeOne/Spatial/ORM/Query/AST/Functions/MySql/SpDistanceSphere.php: -------------------------------------------------------------------------------- 1 | 2017-2025 9 | * Copyright Longitude One 2020-2025 10 | * Copyright 2015 Derek J. Lambert 11 | * 12 | * For the full copyright and license information, please view the LICENSE 13 | * file that was distributed with this source code. 14 | * 15 | */ 16 | 17 | declare(strict_types=1); 18 | 19 | namespace LongitudeOne\Spatial\ORM\Query\AST\Functions\MySql; 20 | 21 | use Doctrine\DBAL\Platforms\AbstractPlatform; 22 | use Doctrine\DBAL\Platforms\MySQLPlatform; 23 | use LongitudeOne\Spatial\ORM\Query\AST\Functions\AbstractSpatialDQLFunction; 24 | 25 | /** 26 | * ST_Distance_Sphere DQL function. 27 | * 28 | * Be careful, this function is not described in the ISO/IEC 13249. 29 | * So this class is not in the Standard directory. 30 | * With MySQL, its name's ST_Distance_Sphere. 31 | * With PostGreSQL, its name's ST_DistanceSphere since PostGis 2.1. 32 | * So these two functions cannot be merged in a class stored in the Common directory. 33 | * 34 | * @author Alexandre Tranchant 35 | */ 36 | class SpDistanceSphere extends AbstractSpatialDQLFunction 37 | { 38 | /** 39 | * Function SQL name getter. 40 | */ 41 | protected function getFunctionName(): string 42 | { 43 | return 'ST_Distance_Sphere'; 44 | } 45 | 46 | /** 47 | * Maximum number of parameter for the spatial function. 48 | * 49 | * @return int the inherited methods shall NOT return null, but 0 when function has no parameter 50 | */ 51 | protected function getMaxParameter(): int 52 | { 53 | return 2; 54 | } 55 | 56 | /** 57 | * Minimum number of parameter for the spatial function. 58 | * 59 | * @since 2.0 This function replace the protected property minGeomExpr. 60 | * 61 | * @return int the inherited methods shall NOT return null, but 0 when function has no parameter 62 | */ 63 | protected function getMinParameter(): int 64 | { 65 | return 2; 66 | } 67 | 68 | /** 69 | * Get the platforms accepted. 70 | * 71 | * @since 2.0 This function replace the protected property platforms. 72 | * @since 5.0 This function returns the class-string[] instead of string[] 73 | * 74 | * @return class-string[] a non-empty array of accepted platforms 75 | */ 76 | protected function getPlatforms(): array 77 | { 78 | return [MySQLPlatform::class]; 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /lib/LongitudeOne/Spatial/ORM/Query/AST/Functions/MariaDB/StNumInteriorRings.php: -------------------------------------------------------------------------------- 1 | 2017-2025 9 | * Copyright Longitude One 2020-2025 10 | * Copyright 2015 Derek J. Lambert 11 | * 12 | * For the full copyright and license information, please view the LICENSE 13 | * file that was distributed with this source code. 14 | * 15 | */ 16 | 17 | declare(strict_types=1); 18 | 19 | namespace LongitudeOne\Spatial\ORM\Query\AST\Functions\MariaDB; 20 | 21 | use Doctrine\DBAL\Platforms\AbstractPlatform; 22 | use Doctrine\DBAL\Platforms\MariaDBPlatform; 23 | use LongitudeOne\Spatial\ORM\Query\AST\Functions\AbstractSpatialDQLFunction; 24 | 25 | /** 26 | * ST_NumInteriorRings DQL function. 27 | * 28 | * MariaDB does not implements ST_NumInteriorRing, but ST_NumInteriorRings 29 | * 30 | * @author Alexandre Tranchant 31 | * @license https://alexandre-tranchant.mit-license.org MIT 32 | */ 33 | class StNumInteriorRings extends AbstractSpatialDQLFunction 34 | { 35 | /** 36 | * Function SQL name getter. 37 | * 38 | * @since 2.0 This function replace the protected property functionName. 39 | */ 40 | protected function getFunctionName(): string 41 | { 42 | return 'ST_NumInteriorRings'; 43 | } 44 | 45 | /** 46 | * Maximum number of parameters for the spatial function. 47 | * 48 | * @return int the inherited methods shall NOT return null, but 0 when function has no parameter 49 | * 50 | * @since 2.0 This function replace the protected property maxGeomExpr. 51 | */ 52 | protected function getMaxParameter(): int 53 | { 54 | return 1; 55 | } 56 | 57 | /** 58 | * Minimum number of parameters for the spatial function. 59 | * 60 | * @return int the inherited methods shall NOT return null, but 0 when function has no parameter 61 | * 62 | * @since 2.0 This function replace the protected property minGeomExpr. 63 | */ 64 | protected function getMinParameter(): int 65 | { 66 | return 1; 67 | } 68 | 69 | /** 70 | * Get the platforms accepted. 71 | * 72 | * @return class-string[] a non-empty array of accepted platforms 73 | * 74 | * @since 5.0 This function returns the class-string[] instead of string[] 75 | * @since 2.0 This function replace the protected property platforms. 76 | */ 77 | protected function getPlatforms(): array 78 | { 79 | return [MariaDBPlatform::class]; 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /lib/LongitudeOne/Spatial/ORM/Query/AST/Functions/MariaDB/SpDistanceSphere.php: -------------------------------------------------------------------------------- 1 | 2017-2025 9 | * Copyright Longitude One 2020-2025 10 | * Copyright 2015 Derek J. Lambert 11 | * 12 | * For the full copyright and license information, please view the LICENSE 13 | * file that was distributed with this source code. 14 | * 15 | */ 16 | 17 | declare(strict_types=1); 18 | 19 | namespace LongitudeOne\Spatial\ORM\Query\AST\Functions\MariaDB; 20 | 21 | use Doctrine\DBAL\Platforms\AbstractPlatform; 22 | use Doctrine\DBAL\Platforms\MariaDBPlatform; 23 | use LongitudeOne\Spatial\ORM\Query\AST\Functions\AbstractSpatialDQLFunction; 24 | 25 | /** 26 | * ST_Distance_Sphere DQL function. 27 | * 28 | * Be careful, this function is not described in the ISO/IEC 13249. 29 | * So this class is not in the Standard directory. 30 | * With MariaDB, its name's ST_Distance_Sphere. 31 | * With PostGreSQL, its name's ST_DistanceSphere since PostGis 2.1. 32 | * So these two functions cannot be merged in a class stored in the Common directory. 33 | * 34 | * @author Alexandre Tranchant 35 | */ 36 | class SpDistanceSphere extends AbstractSpatialDQLFunction 37 | { 38 | /** 39 | * Function SQL name getter. 40 | */ 41 | protected function getFunctionName(): string 42 | { 43 | return 'ST_Distance_Sphere'; 44 | } 45 | 46 | /** 47 | * Maximum number of parameter for the spatial function. 48 | * 49 | * @return int the inherited methods shall NOT return null, but 0 when function has no parameter 50 | */ 51 | protected function getMaxParameter(): int 52 | { 53 | return 2; 54 | } 55 | 56 | /** 57 | * Minimum number of parameter for the spatial function. 58 | * 59 | * @since 2.0 This function replace the protected property minGeomExpr. 60 | * 61 | * @return int the inherited methods shall NOT return null, but 0 when function has no parameter 62 | */ 63 | protected function getMinParameter(): int 64 | { 65 | return 2; 66 | } 67 | 68 | /** 69 | * Get the platforms accepted. 70 | * 71 | * @since 2.0 This function replace the protected property platforms. 72 | * @since 5.0 This function returns the class-string[] instead of string[] 73 | * 74 | * @return class-string[] a non-empty array of accepted platforms 75 | */ 76 | protected function getPlatforms(): array 77 | { 78 | return [MariaDBPlatform::class]; 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /lib/LongitudeOne/Spatial/ORM/Query/AST/Functions/Standard/StArea.php: -------------------------------------------------------------------------------- 1 | 2017-2025 9 | * Copyright Longitude One 2020-2025 10 | * Copyright 2015 Derek J. Lambert 11 | * 12 | * For the full copyright and license information, please view the LICENSE 13 | * file that was distributed with this source code. 14 | * 15 | */ 16 | 17 | declare(strict_types=1); 18 | 19 | namespace LongitudeOne\Spatial\ORM\Query\AST\Functions\Standard; 20 | 21 | use Doctrine\DBAL\Platforms\AbstractPlatform; 22 | use Doctrine\DBAL\Platforms\MariaDBPlatform; 23 | use Doctrine\DBAL\Platforms\MySQLPlatform; 24 | use Doctrine\DBAL\Platforms\PostgreSQLPlatform; 25 | use LongitudeOne\Spatial\ORM\Query\AST\Functions\AbstractSpatialDQLFunction; 26 | 27 | /** 28 | * ST_Area DQL function. 29 | * 30 | * @author Alexandre Tranchant 31 | * @license https://alexandre-tranchant.mit-license.org MIT 32 | */ 33 | class StArea extends AbstractSpatialDQLFunction 34 | { 35 | /** 36 | * Function SQL name getter. 37 | * 38 | * @since 2.0 This function replace the protected property functionName. 39 | */ 40 | protected function getFunctionName(): string 41 | { 42 | return 'ST_Area'; 43 | } 44 | 45 | /** 46 | * Maximum number of parameter for the spatial function. 47 | * 48 | * @since 2.0 This function replace the protected property maxGeomExpr. 49 | * 50 | * @return int the inherited methods shall NOT return null, but 0 when function has no parameter 51 | */ 52 | protected function getMaxParameter(): int 53 | { 54 | return 1; 55 | } 56 | 57 | /** 58 | * Minimum number of parameter for the spatial function. 59 | * 60 | * @since 2.0 This function replace the protected property minGeomExpr. 61 | * 62 | * @return int the inherited methods shall NOT return null, but 0 when function has no parameter 63 | */ 64 | protected function getMinParameter(): int 65 | { 66 | return 1; 67 | } 68 | 69 | /** 70 | * Get the platforms accepted. 71 | * 72 | * @since 2.0 This function replace the protected property platforms. 73 | * @since 5.0 This function returns the class-string[] instead of string[] 74 | * 75 | * @return class-string[] a non-empty array of accepted platforms 76 | */ 77 | protected function getPlatforms(): array 78 | { 79 | return [PostgreSQLPlatform::class, MySQLPlatform::class, MariaDBPlatform::class]; 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /lib/LongitudeOne/Spatial/ORM/Query/AST/Functions/Standard/StPointN.php: -------------------------------------------------------------------------------- 1 | 2017-2025 9 | * Copyright Longitude One 2020-2025 10 | * Copyright 2015 Derek J. Lambert 11 | * 12 | * For the full copyright and license information, please view the LICENSE 13 | * file that was distributed with this source code. 14 | * 15 | */ 16 | 17 | declare(strict_types=1); 18 | 19 | namespace LongitudeOne\Spatial\ORM\Query\AST\Functions\Standard; 20 | 21 | use Doctrine\DBAL\Platforms\AbstractPlatform; 22 | use Doctrine\DBAL\Platforms\MariaDBPlatform; 23 | use Doctrine\DBAL\Platforms\MySQLPlatform; 24 | use Doctrine\DBAL\Platforms\PostgreSQLPlatform; 25 | use LongitudeOne\Spatial\ORM\Query\AST\Functions\AbstractSpatialDQLFunction; 26 | 27 | /** 28 | * ST_PointN DQL function. 29 | * 30 | * @author Alexandre Tranchant 31 | * @license https://alexandre-tranchant.mit-license.org MIT 32 | */ 33 | class StPointN extends AbstractSpatialDQLFunction 34 | { 35 | /** 36 | * Function SQL name getter. 37 | * 38 | * @since 2.0 This function replace the protected property functionName. 39 | */ 40 | protected function getFunctionName(): string 41 | { 42 | return 'ST_PointN'; 43 | } 44 | 45 | /** 46 | * Maximum number of parameters for the spatial function. 47 | * 48 | * @since 2.0 This function replace the protected property maxGeomExpr. 49 | * 50 | * @return int the inherited methods shall NOT return null, but 0 when function has no parameter 51 | */ 52 | protected function getMaxParameter(): int 53 | { 54 | return 2; 55 | } 56 | 57 | /** 58 | * Minimum number of parameter for the spatial function. 59 | * 60 | * @since 2.0 This function replace the protected property minGeomExpr. 61 | * 62 | * @return int the inherited methods shall NOT return null, but 0 when function has no parameter 63 | */ 64 | protected function getMinParameter(): int 65 | { 66 | return 2; 67 | } 68 | 69 | /** 70 | * Get the platforms accepted. 71 | * 72 | * @since 2.0 This function replace the protected property platforms. 73 | * @since 5.0 This function returns the class-string[] instead of string[] 74 | * 75 | * @return class-string[] a non-empty array of accepted platforms 76 | */ 77 | protected function getPlatforms(): array 78 | { 79 | return [PostgreSQLPlatform::class, MySQLPlatform::class, MariaDBPlatform::class]; 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /lib/LongitudeOne/Spatial/ORM/Query/AST/Functions/Standard/StRelate.php: -------------------------------------------------------------------------------- 1 | 2017-2025 9 | * Copyright Longitude One 2020-2025 10 | * Copyright 2015 Derek J. Lambert 11 | * 12 | * For the full copyright and license information, please view the LICENSE 13 | * file that was distributed with this source code. 14 | * 15 | */ 16 | 17 | declare(strict_types=1); 18 | 19 | namespace LongitudeOne\Spatial\ORM\Query\AST\Functions\Standard; 20 | 21 | use Doctrine\DBAL\Platforms\AbstractPlatform; 22 | use Doctrine\DBAL\Platforms\MariaDBPlatform; 23 | use Doctrine\DBAL\Platforms\MySQLPlatform; 24 | use Doctrine\DBAL\Platforms\PostgreSQLPlatform; 25 | use LongitudeOne\Spatial\ORM\Query\AST\Functions\AbstractSpatialDQLFunction; 26 | 27 | /** 28 | * ST_Relate DQL function. 29 | * 30 | * @author Alexandre Tranchant 31 | * @license https://alexandre-tranchant.mit-license.org 32 | */ 33 | class StRelate extends AbstractSpatialDQLFunction 34 | { 35 | /** 36 | * Function SQL name getter. 37 | * 38 | * @since 2.0 This function replace the protected property functionName. 39 | */ 40 | protected function getFunctionName(): string 41 | { 42 | return 'ST_Relate'; 43 | } 44 | 45 | /** 46 | * Maximum number of parameters for the spatial function. 47 | * 48 | * @since 2.0 This function replace the protected property maxGeomExpr. 49 | * 50 | * @return int the inherited methods shall NOT return null, but 0 when function has no parameter 51 | */ 52 | protected function getMaxParameter(): int 53 | { 54 | return 3; 55 | } 56 | 57 | /** 58 | * Minimum number of parameters for the spatial function. 59 | * 60 | * @since 2.0 This function replace the protected property minGeomExpr. 61 | * 62 | * @return int the inherited methods shall NOT return null, but 0 when function has no parameter 63 | */ 64 | protected function getMinParameter(): int 65 | { 66 | return 2; 67 | } 68 | 69 | /** 70 | * Get the platforms accepted. 71 | * 72 | * @since 2.0 This function replace the protected property platforms. 73 | * @since 5.0 This function returns the class-string[] instead of string[] 74 | * 75 | * @return class-string[] a non-empty array of accepted platforms 76 | */ 77 | protected function getPlatforms(): array 78 | { 79 | return [PostgreSQLPlatform::class, MySQLPlatform::class, MariaDBPlatform::class]; 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /lib/LongitudeOne/Spatial/ORM/Query/AST/Functions/MariaDB/SpBuffer.php: -------------------------------------------------------------------------------- 1 | 2017-2025 9 | * Copyright Longitude One 2020-2025 10 | * Copyright 2015 Derek J. Lambert 11 | * 12 | * For the full copyright and license information, please view the LICENSE 13 | * file that was distributed with this source code. 14 | * 15 | */ 16 | 17 | declare(strict_types=1); 18 | 19 | namespace LongitudeOne\Spatial\ORM\Query\AST\Functions\MariaDB; 20 | 21 | use Doctrine\DBAL\Platforms\AbstractPlatform; 22 | use Doctrine\DBAL\Platforms\MariaDBPlatform; 23 | use LongitudeOne\Spatial\ORM\Query\AST\Functions\AbstractSpatialDQLFunction; 24 | 25 | /** 26 | * Sp_Buffer DQL function. 27 | * MariaDB ST_Buffer function is not able to receive a CHARACTER VARYING as third parameter. 28 | * So Sp_Buffer DQL function is specific to MariaDB. 29 | * 30 | * @author Alexandre Tranchant 31 | * @license https://alexandre-tranchant.mit-license.org MIT 32 | */ 33 | class SpBuffer extends AbstractSpatialDQLFunction 34 | { 35 | /** 36 | * Function SQL name getter. 37 | * 38 | * @since 2.0 This function replace the protected property functionName. 39 | */ 40 | protected function getFunctionName(): string 41 | { 42 | return 'ST_Buffer'; 43 | } 44 | 45 | /** 46 | * Maximum number of parameters for the spatial function. 47 | * 48 | * @since 2.0 This function replace the protected property maxGeomExpr. 49 | * 50 | * @return int the inherited methods shall NOT return null, but 0 when function has no parameter 51 | */ 52 | protected function getMaxParameter(): int 53 | { 54 | return 2; 55 | } 56 | 57 | /** 58 | * Minimum number of parameters for the spatial function. 59 | * 60 | * @since 2.0 This function replace the protected property minGeomExpr. 61 | * 62 | * @return int the inherited methods shall NOT return null, but 0 when function has no parameter 63 | */ 64 | protected function getMinParameter(): int 65 | { 66 | return 2; 67 | } 68 | 69 | /** 70 | * Get the platforms accepted. 71 | * 72 | * @since 2.0 This function replace the protected property platforms. 73 | * @since 5.0 This function returns the class-string[] instead of string[] 74 | * 75 | * @return class-string[] a non-empty array of accepted platforms 76 | */ 77 | protected function getPlatforms(): array 78 | { 79 | return [MariaDBPlatform::class]; 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /lib/LongitudeOne/Spatial/ORM/Query/AST/Functions/Standard/StContains.php: -------------------------------------------------------------------------------- 1 | 2017-2025 9 | * Copyright Longitude One 2020-2025 10 | * Copyright 2015 Derek J. Lambert 11 | * 12 | * For the full copyright and license information, please view the LICENSE 13 | * file that was distributed with this source code. 14 | * 15 | */ 16 | 17 | declare(strict_types=1); 18 | 19 | namespace LongitudeOne\Spatial\ORM\Query\AST\Functions\Standard; 20 | 21 | use Doctrine\DBAL\Platforms\AbstractPlatform; 22 | use Doctrine\DBAL\Platforms\MariaDBPlatform; 23 | use Doctrine\DBAL\Platforms\MySQLPlatform; 24 | use Doctrine\DBAL\Platforms\PostgreSQLPlatform; 25 | use LongitudeOne\Spatial\ORM\Query\AST\Functions\AbstractSpatialDQLFunction; 26 | 27 | /** 28 | * ST_Contains DQL function. 29 | * 30 | * @author Alexandre Tranchant 31 | * @license https://alexandre-tranchant.mit-license.org MIT 32 | */ 33 | class StContains extends AbstractSpatialDQLFunction 34 | { 35 | /** 36 | * Function SQL name getter. 37 | * 38 | * @since 2.0 This function replace the protected property functionName. 39 | */ 40 | protected function getFunctionName(): string 41 | { 42 | return 'ST_Contains'; 43 | } 44 | 45 | /** 46 | * Maximum number of parameters for the spatial function. 47 | * 48 | * @since 2.0 This function replace the protected property maxGeomExpr. 49 | * 50 | * @return int the inherited methods shall NOT return null, but 0 when function has no parameter 51 | */ 52 | protected function getMaxParameter(): int 53 | { 54 | return 2; 55 | } 56 | 57 | /** 58 | * Minimum number of parameters for the spatial function. 59 | * 60 | * @since 2.0 This function replace the protected property minGeomExpr. 61 | * 62 | * @return int the inherited methods shall NOT return null, but 0 when function has no parameter 63 | */ 64 | protected function getMinParameter(): int 65 | { 66 | return 2; 67 | } 68 | 69 | /** 70 | * Get the platforms accepted. 71 | * 72 | * @since 2.0 This function replace the protected property platforms. 73 | * @since 5.0 This function returns the class-string[] instead of string[] 74 | * 75 | * @return class-string[] a non-empty array of accepted platforms 76 | */ 77 | protected function getPlatforms(): array 78 | { 79 | return [PostgreSQLPlatform::class, MySQLPlatform::class, MariaDBPlatform::class]; 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /lib/LongitudeOne/Spatial/ORM/Query/AST/Functions/Standard/StIsClosed.php: -------------------------------------------------------------------------------- 1 | 2017-2025 9 | * Copyright Longitude One 2020-2025 10 | * Copyright 2015 Derek J. Lambert 11 | * 12 | * For the full copyright and license information, please view the LICENSE 13 | * file that was distributed with this source code. 14 | * 15 | */ 16 | 17 | declare(strict_types=1); 18 | 19 | namespace LongitudeOne\Spatial\ORM\Query\AST\Functions\Standard; 20 | 21 | use Doctrine\DBAL\Platforms\AbstractPlatform; 22 | use Doctrine\DBAL\Platforms\MariaDBPlatform; 23 | use Doctrine\DBAL\Platforms\MySQLPlatform; 24 | use Doctrine\DBAL\Platforms\PostgreSQLPlatform; 25 | use LongitudeOne\Spatial\ORM\Query\AST\Functions\AbstractSpatialDQLFunction; 26 | 27 | /** 28 | * ST_IsClosed DQL function. 29 | * 30 | * @author Alexandre Tranchant 31 | * @license https://alexandre-tranchant.mit-license.org MIT 32 | */ 33 | class StIsClosed extends AbstractSpatialDQLFunction 34 | { 35 | /** 36 | * Function SQL name getter. 37 | * 38 | * @since 2.0 This function replace the protected property functionName. 39 | */ 40 | protected function getFunctionName(): string 41 | { 42 | return 'ST_IsClosed'; 43 | } 44 | 45 | /** 46 | * Maximum number of parameter for the spatial function. 47 | * 48 | * @since 2.0 This function replace the protected property maxGeomExpr. 49 | * 50 | * @return int the inherited methods shall NOT return null, but 0 when function has no parameter 51 | */ 52 | protected function getMaxParameter(): int 53 | { 54 | return 1; 55 | } 56 | 57 | /** 58 | * Minimum number of parameter for the spatial function. 59 | * 60 | * @since 2.0 This function replace the protected property minGeomExpr. 61 | * 62 | * @return int the inherited methods shall NOT return null, but 0 when function has no parameter 63 | */ 64 | protected function getMinParameter(): int 65 | { 66 | return 1; 67 | } 68 | 69 | /** 70 | * Get the platforms accepted. 71 | * 72 | * @since 2.0 This function replace the protected property platforms. 73 | * @since 5.0 This function returns the class-string[] instead of string[] 74 | * 75 | * @return class-string[] a non-empty array of accepted platforms 76 | */ 77 | protected function getPlatforms(): array 78 | { 79 | return [PostgreSQLPlatform::class, MySQLPlatform::class, MariaDBPlatform::class]; 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /lib/LongitudeOne/Spatial/ORM/Query/AST/Functions/PostgreSql/SpAsGeoJson.php: -------------------------------------------------------------------------------- 1 | 2017-2025 9 | * Copyright Longitude One 2020-2025 10 | * Copyright 2015 Derek J. Lambert 11 | * 12 | * For the full copyright and license information, please view the LICENSE 13 | * file that was distributed with this source code. 14 | * 15 | */ 16 | 17 | declare(strict_types=1); 18 | 19 | namespace LongitudeOne\Spatial\ORM\Query\AST\Functions\PostgreSql; 20 | 21 | use Doctrine\DBAL\Platforms\AbstractPlatform; 22 | use Doctrine\DBAL\Platforms\PostgreSQLPlatform; 23 | use LongitudeOne\Spatial\ORM\Query\AST\Functions\AbstractSpatialDQLFunction; 24 | use LongitudeOne\Spatial\ORM\Query\AST\Functions\ReturnsGeometryInterface; 25 | 26 | /** 27 | * SP_AsGeoJSON DQL function. 28 | * 29 | * @author Tom Vogt 30 | * @author Alexandre Tranchant 31 | * @license https://mit-license.org MIT 32 | */ 33 | class SpAsGeoJson extends AbstractSpatialDQLFunction implements ReturnsGeometryInterface 34 | { 35 | /** 36 | * Function SQL name getter. 37 | * 38 | * @since 2.0 This function replace the protected property functionName. 39 | */ 40 | protected function getFunctionName(): string 41 | { 42 | return 'ST_AsGeoJson'; 43 | } 44 | 45 | /** 46 | * Maximum number of parameter for the spatial function. 47 | * 48 | * @since 2.0 This function replace the protected property maxGeomExpr. 49 | * 50 | * @return int the inherited methods shall NOT return null, but 0 when function has no parameter 51 | */ 52 | protected function getMaxParameter(): int 53 | { 54 | return 1; 55 | } 56 | 57 | /** 58 | * Minimum number of parameter for the spatial function. 59 | * 60 | * @since 2.0 This function replace the protected property minGeomExpr. 61 | * 62 | * @return int the inherited methods shall NOT return null, but 0 when function has no parameter 63 | */ 64 | protected function getMinParameter(): int 65 | { 66 | return 1; 67 | } 68 | 69 | /** 70 | * Get the platforms accepted. 71 | * 72 | * @since 2.0 This function replace the protected property platforms. 73 | * @since 5.0 This function returns the class-string[] instead of string[] 74 | * 75 | * @return class-string[] a non-empty array of accepted platforms 76 | */ 77 | protected function getPlatforms(): array 78 | { 79 | return [PostgreSQLPlatform::class]; 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /lib/LongitudeOne/Spatial/ORM/Query/AST/Functions/PostgreSql/SpSplit.php: -------------------------------------------------------------------------------- 1 | 2017-2025 9 | * Copyright Longitude One 2020-2025 10 | * Copyright 2015 Derek J. Lambert 11 | * 12 | * For the full copyright and license information, please view the LICENSE 13 | * file that was distributed with this source code. 14 | * 15 | */ 16 | 17 | declare(strict_types=1); 18 | 19 | namespace LongitudeOne\Spatial\ORM\Query\AST\Functions\PostgreSql; 20 | 21 | use Doctrine\DBAL\Platforms\AbstractPlatform; 22 | use Doctrine\DBAL\Platforms\PostgreSQLPlatform; 23 | use LongitudeOne\Spatial\ORM\Query\AST\Functions\AbstractSpatialDQLFunction; 24 | use LongitudeOne\Spatial\ORM\Query\AST\Functions\ReturnsGeometryInterface; 25 | 26 | /** 27 | * SP_Split DQL function. 28 | * 29 | * @author Tom Vogt 30 | * @author Alexandre Tranchant 31 | * @license https://alexandre-tranchant.mit-license.org 32 | */ 33 | class SpSplit extends AbstractSpatialDQLFunction implements ReturnsGeometryInterface 34 | { 35 | /** 36 | * Function SQL name getter. 37 | * 38 | * @since 2.0 This function replace the protected property functionName. 39 | */ 40 | protected function getFunctionName(): string 41 | { 42 | return 'ST_Split'; 43 | } 44 | 45 | /** 46 | * Maximum number of parameter for the spatial function. 47 | * 48 | * @since 2.0 This function replace the protected property maxGeomExpr. 49 | * 50 | * @return int the inherited methods shall NOT return null, but 0 when function has no parameter 51 | */ 52 | protected function getMaxParameter(): int 53 | { 54 | return 2; 55 | } 56 | 57 | /** 58 | * Minimum number of parameter for the spatial function. 59 | * 60 | * @since 2.0 This function replace the protected property minGeomExpr. 61 | * 62 | * @return int the inherited methods shall NOT return null, but 0 when function has no parameter 63 | */ 64 | protected function getMinParameter(): int 65 | { 66 | return 2; 67 | } 68 | 69 | /** 70 | * Get the platforms accepted. 71 | * 72 | * @since 2.0 This function replace the protected property platforms. 73 | * @since 5.0 This function returns the class-string[] instead of string[] 74 | * 75 | * @return class-string[] a non-empty array of accepted platforms 76 | */ 77 | protected function getPlatforms(): array 78 | { 79 | return [PostgreSQLPlatform::class]; 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /lib/LongitudeOne/Spatial/ORM/Query/AST/Functions/Standard/StDimension.php: -------------------------------------------------------------------------------- 1 | 2017-2025 9 | * Copyright Longitude One 2020-2025 10 | * Copyright 2015 Derek J. Lambert 11 | * 12 | * For the full copyright and license information, please view the LICENSE 13 | * file that was distributed with this source code. 14 | * 15 | */ 16 | 17 | declare(strict_types=1); 18 | 19 | namespace LongitudeOne\Spatial\ORM\Query\AST\Functions\Standard; 20 | 21 | use Doctrine\DBAL\Platforms\AbstractPlatform; 22 | use Doctrine\DBAL\Platforms\MariaDBPlatform; 23 | use Doctrine\DBAL\Platforms\MySQLPlatform; 24 | use Doctrine\DBAL\Platforms\PostgreSQLPlatform; 25 | use LongitudeOne\Spatial\ORM\Query\AST\Functions\AbstractSpatialDQLFunction; 26 | 27 | /** 28 | * ST_Dimension DQL function. 29 | * 30 | * @author Alexandre Tranchant 31 | * @license https://alexandre-tranchant.mit-license.org MIT 32 | */ 33 | class StDimension extends AbstractSpatialDQLFunction 34 | { 35 | /** 36 | * Function SQL name getter. 37 | * 38 | * @since 2.0 This function replace the protected property functionName. 39 | */ 40 | protected function getFunctionName(): string 41 | { 42 | return 'ST_Dimension'; 43 | } 44 | 45 | /** 46 | * Maximum number of parameters for the spatial function. 47 | * 48 | * @since 2.0 This function replace the protected property maxGeomExpr. 49 | * 50 | * @return int the inherited methods shall NOT return null, but 0 when function has no parameter 51 | */ 52 | protected function getMaxParameter(): int 53 | { 54 | return 1; 55 | } 56 | 57 | /** 58 | * Minimum number of parameters for the spatial function. 59 | * 60 | * @since 2.0 This function replace the protected property minGeomExpr. 61 | * 62 | * @return int the inherited methods shall NOT return null, but 0 when function has no parameter 63 | */ 64 | protected function getMinParameter(): int 65 | { 66 | return 1; 67 | } 68 | 69 | /** 70 | * Get the platforms accepted. 71 | * 72 | * @since 2.0 This function replace the protected property platforms. 73 | * @since 5.0 This function returns the class-string[] instead of string[] 74 | * 75 | * @return class-string[] a non-empty array of accepted platforms 76 | */ 77 | protected function getPlatforms(): array 78 | { 79 | return [PostgreSQLPlatform::class, MySQLPlatform::class, MariaDBPlatform::class]; 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /lib/LongitudeOne/Spatial/ORM/Query/AST/Functions/Standard/StNumPoints.php: -------------------------------------------------------------------------------- 1 | 2017-2025 9 | * Copyright Longitude One 2020-2025 10 | * Copyright 2015 Derek J. Lambert 11 | * 12 | * For the full copyright and license information, please view the LICENSE 13 | * file that was distributed with this source code. 14 | * 15 | */ 16 | 17 | declare(strict_types=1); 18 | 19 | namespace LongitudeOne\Spatial\ORM\Query\AST\Functions\Standard; 20 | 21 | use Doctrine\DBAL\Platforms\AbstractPlatform; 22 | use Doctrine\DBAL\Platforms\MariaDBPlatform; 23 | use Doctrine\DBAL\Platforms\MySQLPlatform; 24 | use Doctrine\DBAL\Platforms\PostgreSQLPlatform; 25 | use LongitudeOne\Spatial\ORM\Query\AST\Functions\AbstractSpatialDQLFunction; 26 | 27 | /** 28 | * ST_NumPoints DQL function. 29 | * 30 | * @author Alexandre Tranchant 31 | * @license https://alexandre-tranchant.mit-license.org MIT 32 | */ 33 | class StNumPoints extends AbstractSpatialDQLFunction 34 | { 35 | /** 36 | * Function SQL name getter. 37 | * 38 | * @since 2.0 This function replace the protected property functionName. 39 | */ 40 | protected function getFunctionName(): string 41 | { 42 | return 'ST_NumPoints'; 43 | } 44 | 45 | /** 46 | * Maximum number of parameters for the spatial function. 47 | * 48 | * @since 2.0 This function replace the protected property maxGeomExpr. 49 | * 50 | * @return int the inherited methods shall NOT return null, but 0 when function has no parameter 51 | */ 52 | protected function getMaxParameter(): int 53 | { 54 | return 1; 55 | } 56 | 57 | /** 58 | * Minimum number of parameter for the spatial function. 59 | * 60 | * @since 2.0 This function replace the protected property minGeomExpr. 61 | * 62 | * @return int the inherited methods shall NOT return null, but 0 when function has no parameter 63 | */ 64 | protected function getMinParameter(): int 65 | { 66 | return 1; 67 | } 68 | 69 | /** 70 | * Get the platforms accepted. 71 | * 72 | * @since 2.0 This function replace the protected property platforms. 73 | * @since 5.0 This function returns the class-string[] instead of string[] 74 | * 75 | * @return class-string[] a non-empty array of accepted platforms 76 | */ 77 | protected function getPlatforms(): array 78 | { 79 | return [PostgreSQLPlatform::class, MySQLPlatform::class, MariaDBPlatform::class]; 80 | } 81 | } 82 | --------------------------------------------------------------------------------