Skip to main content

st_buffer

Preview

This feature is in Public Preview.

Returns the buffer of the input geometry using the specified radius.

For the corresponding Databricks SQL function, see st_buffer function.

Syntax

Python
from pyspark.databricks.sql import functions as dbf

dbf.st_buffer(col1=<col1>, col2=<col2>)

Parameters

Parameter

Type

Description

col1

pyspark.sql.Column or str

A Geometry value.

col2

pyspark.sql.Column or float

Radius of the buffer. The unit of the radius are those of the coordinate reference system of the geometry.

Examples

Python
from pyspark.databricks.sql import functions as dbf
df = spark.createDataFrame([('POINT(0 0)',)], ['wkt'])
df.select(dbf.st_asewkt(dbf.st_envelope(dbf.st_buffer(dbf.st_geomfromtext('wkt', 4326), 1.0))).alias('result')).collect()
Output
[Row(result='SRID=4326;POLYGON((-1 -1,-1 1,1 1,1 -1,-1 -1))')]