Skip to content

Feature request: ST_Buffer support #99

Open
@aricooperdavis

Description

@aricooperdavis

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

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions