Skip to main content

st_simplify

Preview

This feature is in Public Preview.

Simplifies the input geometry using the Douglas-Peucker algorithm.

For the corresponding Databricks SQL function, see st_simplify function.

Syntax

Python
from pyspark.databricks.sql import functions as dbf

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

Parameters

Parameter

Type

Description

col1

pyspark.sql.Column or str

A Geometry value.

col2

pyspark.sql.Column or float

A DOUBLE value that is the distance value used for the simplification. The distance units are those of the CRS of the input geometry.

Examples

Python
from pyspark.databricks.sql import functions as dbf
df = spark.createDataFrame([('LINESTRING(0 0,5.1 0,10 0,10 3,10 8,16 9)',)], ['wkt'])
df.select(dbf.st_asewkt(dbf.st_simplify(dbf.st_geomfromtext('wkt', 4326), 0.2)).alias('result')).collect()
Output
[Row(result='SRID=4326;LINESTRING(0 0,10 0,10 8,16 9)')]