ST_MPointFromSparkGeom takes a Spark GEOMETRY column and returns a GeoAnalytics Engine multipoint column.
This function is supported with Spark 4.2.0 and above. The function can also be used with Spark 4.1.x after
setting spark.sql.geospatial.enabled to true in the Spark configuration.
| Function | Syntax |
|---|---|
| Python | mpoint |
| SQL | ST |
| Scala | mpoint |
For more details, go to the GeoAnalytics Engine API reference for mpoint_from_spark_geom.
Examples
from geoanalytics.sql import functions as ST
data = [("MULTIPOINT (-72.047 -49.292, -72.654 -49.136, -71.921 -49.124, -72.445 -49.026)",),]
df = spark.createDataFrame(data, ["wkt"]) \
.select(ST.as_spark_geom(ST.mpoint_from_text("wkt", sr=4326)).alias("spark_geom"))
df.select(ST.as_text(ST.mpoint_from_spark_geom("spark_geom")).alias("esri_geom")).show(truncate=False)Result
+---------------------------------------------------------------------------------------+
|esri_geom |
+---------------------------------------------------------------------------------------+
|MULTIPOINT ((-72.047 -49.292), (-72.654 -49.136), (-71.921 -49.124), (-72.445 -49.026))|
+---------------------------------------------------------------------------------------+Version table
| Release | Notes |
|---|---|
2.2.0 | Python, SQL, and Scala functions introduced |