geos_buffer

Geometric functions > geos_buffer

syntax

  • geos_buffer(geometry_data_item, buffer_distance, nrPointsInCircle)

description

geos_buffer(geometry_data_item, buffer_distance, nrPointsInCircle) creates a buffer polygon for each entry of the geometry_data_item, choosing the appropriate buffering at run-time from the composition of the first argument:

The result is always a polygon data item with the same domain unit as the geometry_data_item. Use geos_buffer when you want a single buffering operator that adapts to the geometry it is given; use the specific geos_buffer_* operators when you want to fix the interpretation.

An arc without points, as a null shape record or a selection easily gives, results in an empty polygon, as an empty polygon argument does.

The buffer_distance is a Float64 value that specifies the radius of the buffer in the units of the coordinate system of the geometry_data_item.

The nrPointsInCircle is a UInt8 value that sets how finely the circle is approximated: for arc and multipoint geometry it is the number of points of a full circle, for polygon geometry the number of segments per quarter circle. A higher value gives a smoother buffer, more points and a longer computation.

For a polygon, nrPointsInCircle is given to geos as it is, and geos takes it as the number of segments per quarter circle, so a square buffered with 16 gets about 68 points, and 0 cuts each corner off straight. In the point and arc buffers, and in the bg_ family, the same argument is the number of points of a full circle. It stays this way because existing models are calibrated on it; to give a polygon buffer the corners of a point buffer with n points per circle, pass n / 4.

The geos_ prefix of the function name indicates that the implementation of the operator uses geos.

applies to

conditions

  1. The composition of the geometry_data_item must be arc, polygon or multipoint; any other composition raises an error.
  2. For arc and multipoint geometry, buffer_distance is positive; for polygon geometry a negative distance shrinks the polygons, as in geos_buffer_multi_polygon.
  3. For arc and multipoint geometry, nrPointsInCircle is at least 3.

since version

20.2.0

example

// arc geometry -> linestring buffer
attribute<fpoint> road_buffer (road)     := geos_buffer(road/geometry, 50.0, 8b);
// polygon geometry -> polygon buffer
attribute<fpoint> district_buffer (district) := geos_buffer(district/geometry, 25.0, 16b);
// multipoint geometry -> per-point buffer
attribute<fpoint> station_buffer (city)  := geos_buffer(city/stations, 100.0, 16b);

see also

GeoDMS ©Object Vision BV. Source code distributed under GNU GPL-3. Documentation distributed under CC BY-SA 4.0.