MatanYadaev / laravel-eloquent-spatial

Laravel Eloquent spatial package.
MIT License
328 stars 48 forks source link

Feature request: ST_Buffer support #99

Open aricooperdavis opened 10 months ago

aricooperdavis commented 10 months ago

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 ```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!

MatanYadaev commented 10 months ago

I'll be happy to accept a PR. Thanks!