geos_buffer_multi_polygon

Geometric functions > geos_buffer_multi_polygon

syntax

  • geos_buffer_multi_polygon(polygon_data_item, buffer_distance, nrPointsInCircle)

description

geos_buffer_multi_polygon(polygon_data_item, buffer_distance, nrPointsInCircle) creates an expanded (positive buffer) or contracted (negative buffer) polygon for each element in the polygon_data_item. The result is a polygon data item with the same domain as the input.

The buffer_distance is a Float64 value that specifies the buffer distance in the units of the coordinate system. A positive value expands the polygon outward; a negative value contracts it inward.

The nrPointsInCircle is a UInt8 value: the number of segments per quarter circle with which each convex corner is rounded. A higher value gives a smoother buffer, more points and a longer computation; 0 cuts each corner off straight.

Despite its name, the argument 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. 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 type of the polygon_data_item needs to be polygon.
  2. The order of points in the polygon_data_item needs to be clockwise for exterior bounds and counterclockwise for holes (right-hand-rule).

since version

18

example

// Expand each municipality polygon by 500 metres
attribute<fpoint> buffered_geometry (municipality) := geos_buffer_multi_polygon(municipality/geometry, 500.0, 16b);

// Contract each polygon by 100 metres (negative buffer)
attribute<fpoint> contracted_geometry (district) := geos_buffer_multi_polygon(district/geometry, -100.0, 16b);

see also