ST_PointFromSparkGeom takes a Spark GEOMETRY column and returns a GeoAnalytics Engine point 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.

FunctionSyntax
Pythonpoint_from_spark_geom(geometry)
SQLST_PointFromSparkGeom(geometry)
ScalapointFromSparkGeom(geometry)

For more details, go to the GeoAnalytics Engine API reference for point_from_spark_geom.

Examples

PythonPythonSQLScala
Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9

from geoanalytics.sql import functions as ST

data = [("POINT (-72.047 -49.292)",),]

df = spark.createDataFrame(data, ["wkt"]) \
          .select(ST.as_spark_geom(ST.point_from_text("wkt", sr=4326)).alias("spark_geom"))

df.select(ST.as_text(ST.point_from_spark_geom("spark_geom")).alias("esri_geom")).show(truncate=False)
Result
Use dark colors for code blocksCopy
1
2
3
4
5
+-----------------------+
|esri_geom              |
+-----------------------+
|POINT (-72.047 -49.292)|
+-----------------------+

Version table

ReleaseNotes

2.2.0

Python, SQL, and Scala functions introduced

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.