Skip to content

Commit 97c36fd

Browse files
committed
Expand readme
1 parent 44910c7 commit 97c36fd

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

README.md

+21
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,27 @@ $endPoint->pointN(-1); // throws exception as you cant ST_PointN on a point
265265
Currently we only have expression subclasses for geometry, but we might have
266266
other types (integer valued expression, area valued expression and so on) later.
267267

268+
### Geometry class
269+
270+
In addition to base Expression tools, `Geometry` (and all the GIS subclass) has these helpers:
271+
272+
```php
273+
// Wrap the expression in a function call
274+
$myGeometry = new Geometry('col');
275+
$myGeometry->wrap('COUNT'); // COUNT(col)
276+
277+
// Query the geometry against another geometry
278+
$myGeometry = new Point('start');
279+
$myGeometry->query('ST_Distance', new Point('end')); // Expression holding ST_Distance(start, end)
280+
// This also autowraps the second arg as a geometry if you pass a string
281+
$myGeometry->query('ST_Distance', 'end'); // Expression holding ST_Distance(start, end)
282+
283+
// Combine the geometry with another
284+
$point = new Point('start');
285+
$point->combine('ST_Union', 'end'); // Geometry holding ST_Union(start, end)
286+
// The only difference is that ->query() returns a base Expression, but ->combine() returns a Geometry
287+
```
288+
268289
### Hierarchy and composition
269290

270291
The geometry class hierarchy as defined in the OGC spec along with the required

0 commit comments

Comments
 (0)