mjaschen / phpgeo

Simple Yet Powerful Geo Library for PHP
https://phpgeo.marcusjaschen.de
MIT License
1.55k stars 195 forks source link

Geofence from point #101

Open rgonzalez-in opened 1 year ago

rgonzalez-in commented 1 year ago

Hello:

How create a Geofence from a Point with Buffer?

Regards.

acleon commented 3 months ago

Assuming you want a circular geofence around a point, you need to travel the "buffer" distance in various directions from your start point, then use those points to form a ring polygon. The key object here is the bearing calculator - either BearingSpherical or BearingEllipsoidal.

Here's a Gist showing the approach....

https://gist.github.com/acleon/0237a69dc75a23fb7dc81724c961b1ba