Open aricooperdavis opened 10 months ago
It would be brilliant if the API spatial scopes could be expanded to support ST_Buffer, e.g.
ST_Buffer
Filters records within a buffer. Uses ST_Buffer.
$column
Geometry \ string
$geometryOrColumn
$value
int \ float
I will see if I can submit a PR, but with Christmas coming up it won't be for a little while!
I'll be happy to accept a PR. Thanks!
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.
$column
Geometry \ string
$geometryOrColumn
Geometry \ string
$value
int \ float
Example
```php 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!