Skip to content

Commit 04a6024

Browse files
author
Jon West
committed
Adding STGeomFromGeoJSON and MakeEnvelope
1 parent 97f02ae commit 04a6024

File tree

3 files changed

+45
-2
lines changed

3 files changed

+45
-2
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ Currently the following SQL functions are supported in DQL (more coming):
5353
* ST_Envelope
5454
* ST_Expand
5555
* ST_Extent
56+
* ST_GeomFromGeoJSON
5657
* ST_GeomFromText
5758
* ST_Intersection
5859
* ST_Intersects
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<?php
2+
/**
3+
* Copyright (C) 2012 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+
*/
23+
24+
namespace CrEOF\Spatial\ORM\Query\AST\Functions\PostgreSql;
25+
26+
use CrEOF\Spatial\ORM\Query\AST\Functions\AbstractSpatialDQLFunction;
27+
28+
/**
29+
* ST_GeomFromGeoJSON DQL function
30+
* @author Derek J. Lambert <dlambert@dereklambert.com>
31+
* @license http://dlambert.mit-license.org MIT
32+
*/
33+
class ST_GeomFromGeoJSON extends AbstractSpatialDQLFunction
34+
{
35+
protected $platforms = array('postgresql');
36+
37+
protected $functionName = 'ST_GeomFromGeoJSON';
38+
39+
protected $minGeomExpr = 1;
40+
41+
protected $maxGeomExpr = 1;
42+
}

lib/CrEOF/Spatial/ORM/Query/AST/Functions/PostgreSql/STMakeEnvelope.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class STMakeEnvelope extends AbstractSpatialDQLFunction
3939

4040
protected $functionName = 'ST_MakeEnvelope';
4141

42-
protected $minGeomExpr = 2;
42+
protected $minGeomExpr = 5;
4343

44-
protected $maxGeomExpr = 2;
44+
protected $maxGeomExpr = 5;
4545
}

0 commit comments

Comments
 (0)