Skip to main content

st_envelope

Preview

This feature is in Public Preview.

Returns the 2D Cartesian axis-aligned minimum bounding box (envelope) of the input non-empty geometry, as a geometry. Empty input geometries are returned as is.

For the corresponding Databricks SQL function, see st_envelope function.

Syntax

Python
from pyspark.databricks.sql import functions as dbf

dbf.st_envelope(col=<col>)

Parameters

Parameter

Type

Description

col

pyspark.sql.Column or str

A Geometry value.

Examples

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