Skip to content

geos_buffer

MaartenHilferink edited this page Oct 1, 2026 · 6 revisions

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.

Since GeoDMS 20.22.0 an arc without points, as a null shape record or a selection easily gives, results in an empty polygon, as an empty polygon argument already did. Before, such an arc crashed the application with an access violation.

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 specifies the number of points used to approximate the circle. A higher value results in a smoother buffer but increases computation time. The minimum value is 3.

For a polygon, nrPointsInCircle is given to geos as it is, and geos takes it as the number of segments per quarter circle: each rounded corner of a polygon gets nrPointsInCircle segments, so a square buffered with 16 gets about 68 points. This differs from the point and arc buffers, where nrPointsInCircle is the number of points of a full circle, and from the bg_ family. The difference is kept because existing models are calibrated on it; to get a polygon buffer with the corners of a point buffer of 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. buffer_distance must be a positive value.
  3. nrPointsInCircle must be 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.

Clone this wiki locally