Skip to content

ST_BUFFER

Computes a POLYGON or MULTIPOLYGON representing all points within a specified distance from a GEOGRAPHY object.

See also:

Syntax

sql
ST_BUFFER(<input>, <radius>, <num_seg_quarter_circle> = 8)

Arguments

  • <input>: The GEOGRAPHY to calculate the buffer around
  • <radius>: Distance in meters. Negative values shrink the GEOGRAPHY instead of expanding it
  • <num_seg_quarter_circle>: Number of line segments used to approximate a quarter circle (default 8)

Returns

Returns a GEOGRAPHY representing the buffer area. Special cases include:

  • A negative radius applied to points or lines returns an empty GEOGRAPHY
  • A negative radius applied to polygons may result in an empty GEOGRAPHY if the shape is completely removed

Example

sql
SELECT ST_AsText(ST_Buffer('POINT(0 0)'::GEOGRAPHY, 10, 2));
-- POLYGON((0.00009 0,0.00006 -0.00006,0 -0.00009,-0.00006 -0.00006,-0.00009 0,-0.00006 0.00006,0 0.00009,0.00006 0.00006,0.00009 0))