Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Applies to:
Databricks SQL
Databricks Runtime 17.1 and above
Important
This feature is in Public Preview.
Note
This feature is not available on Databricks SQL Classic warehouses. To learn more about Databricks SQL warehouses, see SQL warehouse types.
Returns the buffer of the input GEOMETRY value using the specified radius.
Syntax
st_buffer ( geoExpr, radiusExpr )
Arguments
geoExpr: AGEOMETRYvalue.radiusExpr: ADOUBLEvalue as radius of the buffer. The unit of the radius are those of the coordinate reference system of the geometry.
Returns
Returns the buffer of the input GEOMETRY value using the specified radius.
The buffer is the Minkowski sum (if the radius is non-negative) or the Minkowski difference (if
the radius is negative) of this geometry with a disk whose radius is the given radius radiusExpr. The
boundary of the result consists, in theory, of circles or circular arcs. Here we approximate
these arcs with polylines, and return the result as a geometry value.
The result is always a 2D polygon or multipolygon (Z and M coordinates in the input are dropped).
Examples
-- Expands a point into a circle-like polygon with a 1-unit radius.
> SELECT st_astext(st_envelope(st_buffer(st_geomfromtext('POINT(0 0)'), 1)));
POLYGON((-1 -1,-1 1,1 1,1 -1,-1 -1))
-- Shrinks a small polygon so much that nothing is left
> SELECT st_astext(st_buffer(st_geomfromtext('POLYGON((0 0,2 0,2 2,0 2,0 0))'), -5));
POLYGON EMPTY