All Products
Search
Document Center

PolarDB:ST_3DBuffer

Last Updated:Mar 28, 2026

ST_3DBuffer extends a 3D point or LineString by a specified radius to produce a closed mesh buffer.

Syntax

meshgeom ST_3DBuffer(geometry geom3d, float8 buffer_radius, boolean round_end default true, float8 smooth default 0.5)

Parameters

ParameterTypeDefaultDescription
geom3dgeometryThe input geometry. Accepts Point or LineString.
buffer_radiusfloat8The buffer radius.
round_endbooleantrueControls the endpoint shape for LineString buffers. true adds a hemisphere cap at each endpoint. false leaves endpoints flat with no cap.
smoothfloat80.5Controls the triangle side length on the buffer surface. Valid values: (0, 1]. A smaller value produces finer triangles and a smoother surface that more closely approximates a curved surface. Requires round_end to be explicitly set.

Parameter dependency:

  • If round_end is not set, omit smooth as well.

  • If round_end is not set but smooth is provided, a parsing error occurs.

  • If round_end is set, smooth is optional and defaults to 0.5.

Examples

All examples use ST_AsText to display the MESHGEOM output as text.

Buffer around a Point (default parameters):

SELECT ST_AsText(ST_3DBuffer('POINT(0 0 0)', 2));

Output:

MESHGEOM(PATCH(INDEXSURFACE Z (VERTEX(0 0 2,-0.894427190999916 0 1.78885438199983,-0.447213595499958 ...
Buffer for a 3D point when smooth is 0.5Buffer for a 3D point when smooth is 0.8

Buffer around a LineString with flat endpoints (`round_end=false`):

SELECT ST_AsText(ST_3DBuffer('LINESTRING(1 2 3, 0 0 4)', 0.5, false));

Output:

MESHGEOM(PATCH(INDEXSURFACE Z (VERTEX(1.43294188107951 1.89763792560716 3.22821773229382,1.30266373925419...
Buffer for a 3D linestring with round_end set to false

Buffer around a LineString with hemisphere endpoints and custom smoothness (`round_end=true`, `smooth=0.6`):

SELECT ST_AsText(ST_3DBuffer('LINESTRING(0 1 0, 1 3 2, 2 1 1)', 1, true, 0.6));

Output:

MESHGEOM(PATCH(INDEXSURFACE Z (VERTEX(-0.89885050178969 1.01131599079557 0.438109260099278...
Buffer for a 3D linestring with round_end true and smooth 0.5Buffer for a 3D linestring with round_end true and smooth 0.3