twpayne / go-geom

Package geom implements efficient geometry types for geospatial applications.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

creating buffer around point

rayhaanq opened this issue · 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

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.