Share via


st_point

Important

This feature is in Public Preview.

Returns a 2D point Geometry with the given x and y coordinates and SRID value. If no SRID value is provided, or if the provided SRID value is negative, the SRID value of the point geometry will be set to 0.

For the corresponding Databricks SQL function, see st_point function.

Syntax

from pyspark.databricks.sql import functions as dbf

dbf.st_point(col1=<col1>, col2=<col2>, col3=<col3>)

Parameters

Parameter Type Description
col1 pyspark.sql.Column or float The X coordinate of the point geometry.
col2 pyspark.sql.Column or float The Y coordinate of the point geometry.
col3 pyspark.sql.Column or int, optional The SRID value of the point geometry.

Examples

from pyspark.databricks.sql import functions as dbf
df = spark.createDataFrame([(1.0, 2.0, 4326,)], ['x', 'y', 'srid'])
df.select(dbf.st_asewkt(dbf.st_point('x', 'y', 'srid')).alias('result')).collect()
[Row(result='SRID=4326;POINT(1 2)')]
from pyspark.databricks.sql import functions as dbf
df = spark.createDataFrame([(1.0, 2.0,)], ['x', 'y'])
df.select(dbf.st_asewkt(dbf.st_point('x', 'y', 0)).alias('result')).collect()
[Row(result='POINT(1 2)')]
from pyspark.databricks.sql import functions as dbf
df = spark.createDataFrame([(1.0, 2.0, 0,)], ['x', 'y', 'srid'])
df.select(dbf.st_asewkt(dbf.st_point('x', 'y', 'srid')).alias('result')).collect()
[Row(result='POINT(1 2)')]
from pyspark.databricks.sql import functions as dbf
df = spark.createDataFrame([(1.0, 2.0,)], ['x', 'y'])
df.select(dbf.st_asewkt(dbf.st_point('x', 'y')).alias('result')).collect()
[Row(result='POINT(1 2)')]