ST_Simplify takes a geometry column and returns a geometry column which contains the simplified geometries. This function simplifies the input geometry according to the OpenGIS Simple Features Implementation Specification for SQL 1.2.1.
Function | Syntax |
---|---|
Python | simplify(geometry) |
SQL | ST |
Scala | simplify(geometry) |
For more details, go to the GeoAnalytics for Microsoft Fabric API reference for simplify.
Examples
from geoanalytics_fabric.sql import functions as ST, Linestring
data = [
(Linestring([[[5,5],[7,6],[6,6],[6,8]]]), ),
(Linestring([[[5,5],[7,6],[6,6],[6,6],[5,5]]]), )
]
df = spark.createDataFrame(data, ["linestring"])
df.withColumn("is_simple", ST.is_simple("linestring"))\
.show(truncate=False)
df.select(ST.simplify("linestring").alias("simplify_linestring"))\
.withColumn("is_simple", ST.is_simple("simplify_linestring"))\
.show(truncate=False)
Result
+-------------------------------------------+---------+
|linestring |is_simple|
+-------------------------------------------+---------+
|{"paths":[[[5,5],[7,6],[6,6],[6,8]]]} |true |
|{"paths":[[[5,5],[7,6],[6,6],[6,6],[5,5]]]}|false |
+-------------------------------------------+---------+
+-------------------------------------+---------+
|simplify_linestring |is_simple|
+-------------------------------------+---------+
|{"paths":[[[5,5],[7,6],[6,6],[6,8]]]}|true |
|{"paths":[[[5,5],[7,6],[6,6],[5,5]]]}|true |
+-------------------------------------+---------+
Version table
Release | Notes |
---|---|
1.0.0-beta | Python, SQL, and Scala functions introduced |