dms_buffer_multi_polygon

Geometric functions > dms_buffer_multi_polygon

dms_buffer_multi_polygon grows or shrinks every polygon by a distance, with rounded corners, on the sweep that GeoDMS implements itself: the dms_ counterpart of geos_buffer_multi_polygon, with the same arguments.

syntax

  • dms_buffer_multi_polygon(polygon_data_item, buffer_distance, quadrantSegments)

description

Since GeoDMS 20.24.0.

dms_buffer_multi_polygon(polygon_data_item, buffer_distance, quadrantSegments) results in a polygon data item with, per element, the area within buffer_distance of the element: every edge shifted outward by exactly buffer_distance, and every convex corner rounded. A negative buffer_distance shrinks the element instead; distance 0 gives the element cleaned.

quadrantSegments is the number of segments per quarter circle, as geos_buffer_multi_polygon takes its third argument: a corner of 90 degrees gets that many segments, a sharper or blunter corner proportionally more or fewer (the corner’s turn divided by a quarter turn, times quadrantSegments, rounded), each of equal angle. 0 cuts a corner off straight. This is where GEOS puts the points too, so a configuration can switch between the geos_ and the dms_ buffer with the same arguments and get results that agree to far below a millimetre:

parameter<string> buffer_expr := GeoEngine == 'dms'
	? 'dms_buffer_multi_polygon(pand/geometry, 0.2, 8b)'
	: 'geos_buffer_multi_polygon(pand/geometry, 0.2, 8b)';

Like the other dms polygon operators, it reads its argument under the even-odd rule, so it accepts polygons that are not valid: rings that cross or touch themselves, overlap each other, are wound either way or are not closed. The geometry is cleaned first, then buffered in one sweep per element; a convex element needs no sweep at all. Results are on the same lattice as the rest of the family: for float coordinates a power of two derived from the extent of the element and the distance, far below any real precision.

A hole that the buffer fills is gone from the result, as with GEOS. An element that shrinks to nothing results in an empty polygon; an undefined distance gives an empty polygon too.

applies to

conditions

  1. The composition type of polygon_data_item must be polygon.
  2. For integer coordinates the corner points are rounded to whole coordinates, so a distance of a few units gives coarse corners; use float coordinates for small distances.

since version

20.24.0

examples

// grow every building by 20 cm, 8 segments per quarter circle
attribute<rdc> pand_buffer (pand, polygon) := dms_buffer_multi_polygon(pand/geometry, 0.2, 8b);

// shrink every parcel by 1 metre
attribute<rdc> parcel_core (parcel, polygon) := dms_buffer_multi_polygon(parcel/geometry, -1.0, 8b);

see also