Open
Description
It would be brilliant if the API spatial scopes could be expanded to support ST_Buffer
, e.g.
whereBuffer
Filters records within a buffer. Uses ST_Buffer.
parameter name | type |
---|---|
$column |
Geometry \ string |
$geometryOrColumn |
Geometry \ string |
$value |
int \ float |
Example
Place::create(['location' => new Point(1, 1.5)]);
$placesCountWithinBuffer = Place::query()
->whereBuffer('location', Polygon::fromJson('{"type":"Polygon","coordinates":[[[-1,-1],[1,-1],[1,1],[-1,1],[-1,-1]]]}'), 3)
->count();
echo $placesCountWithinBuffer; // 1
I will see if I can submit a PR, but with Christmas coming up it won't be for a little while!
Metadata
Metadata
Assignees
Labels
No labels