ST_Buffer - Amazon Neptune
Services or capabilities described in AWS documentation might vary by Region. To see the differences applicable to the AWS European Sovereign Cloud Region, see the AWS European Sovereign Cloud User Guide.

ST_Buffer

ST_Buffer returns 2D geometry that represents all points whose distance from the input geometry projected on the xy-Cartesian plane is less than or equal to the input distance.

Syntax

ST_Buffer(geom, distance, number_of_segments_per_quarter_circle)

Arguments

  • geom - A value of data type GEOMETRY or an expression that evaluates to a GEOMETRY type.

  • distance - A value of data type DOUBLE PRECISION that represents distance (or radius) of the buffer.

  • number_of_segments_per_quarter_circle - A value of data type INTEGER (should be larger or equal to 0). This value determines the number of points to approximate a quarter circle around each vertex of the input geometry. Negative values default to zero. The default is 8.

Return type

GEOMETRY

The ST_Buffer function returns two-dimensional (2D) geometry in the xy-Cartesian plane.

Examples

RETURN ST_Buffer(ST_GeomFromText('LINESTRING (1 2,5 2,5 8)'), 2, 4); POLYGON ((3 4, 3 8, 3.1522409349774265 8.76536686473018, 3.585786437626905 9.414213562373096, 4.234633135269821 9.847759065022574, 5 10, 5.765366864730179 9.847759065022574, 6.414213562373095 9.414213562373096, 6.847759065022574 8.76536686473018, 7 8, 7 2, 6.847759065022574 1.2346331352698203, 6.414213562373095 0.5857864376269051, 5.765366864730179 0.1522409349774265, 5 0, 1 0, 0.2346331352698193 0.152240934977427, -0.4142135623730954 0.5857864376269051, -0.8477590650225737 1.2346331352698208, -1 2.0000000000000004, -0.8477590650225735 2.7653668647301797, -0.4142135623730949 3.414213562373095, 0.2346331352698206 3.8477590650225735, 1 4, 3 4))

The following returns the buffer of the input point geometry which approximates a circle. Because the command specifies 3 as the number of segments per quarter circle, the function uses three segments to approximate the quarter circle.

RETURN ST_Buffer(ST_GeomFromText('POINT (1 1)'), 1.0, 8)); POLYGON ((2 1, 1.9807852804032304 0.8049096779838718, 1.9238795325112867 0.6173165676349102, 1.8314696123025453 0.4444297669803978, 1.7071067811865475 0.2928932188134525, 1.5555702330196022 0.1685303876974548, 1.3826834323650898 0.0761204674887133, 1.1950903220161284 0.0192147195967696, 1 0, 0.8049096779838718 0.0192147195967696, 0.6173165676349103 0.0761204674887133, 0.444429766980398 0.1685303876974545, 0.2928932188134525 0.2928932188134524, 0.1685303876974546 0.4444297669803978, 0.0761204674887133 0.6173165676349102, 0.0192147195967696 0.8049096779838714, 0 0.9999999999999999, 0.0192147195967696 1.1950903220161284, 0.0761204674887132 1.3826834323650896, 0.1685303876974545 1.555570233019602, 0.2928932188134523 1.7071067811865475, 0.4444297669803978 1.8314696123025453, 0.6173165676349097 1.9238795325112865, 0.8049096779838714 1.9807852804032304, 0.9999999999999998 2, 1.1950903220161284 1.9807852804032304, 1.38268343236509 1.9238795325112865, 1.5555702330196017 1.8314696123025453, 1.7071067811865475 1.7071067811865477, 1.8314696123025453 1.5555702330196022, 1.9238795325112865 1.3826834323650905, 1.9807852804032304 1.1950903220161286, 2 1))