go-geom icon indicating copy to clipboard operation
go-geom copied to clipboard

creating buffer around point

Open rayhaanq opened this issue 5 years ago • 2 comments

Hi, I was just wondering if it would be possible to create a buffer around a point. How would you implement this with this library? This would be the equivalent of ST_Buffer

rayhaanq avatar Mar 09 '19 12:03 rayhaanq

#206

aryehlev avatar Nov 05 '21 15:11 aryehlev

Creating a buffer around a single point is relatively straightforward: the resulting geometry is a circle (likely simplified to a polygon with an appropriate number of points).

ST_Buffer is significantly more complicated to implement as it works on arbitrary geometries. As a simple example, ST_Buffer around two identical points returns a single circle (possibly simplified to polygon), ST_Buffer around two neighboring points returns the union of two overlapping circles (still representable as a polygon), and ST_Buffer around two well-separated points returns two non-overlapping circles (now only representable as a multipolygon).

If you need this functionality, GEOS is a tried and tested library for these operations. go-geos provides Go bindings to it, but comes with many caveats. This is not an easy problem.

twpayne avatar Nov 17 '21 23:11 twpayne