הערה
גישה לעמוד זה דורשת אישור. אתה יכול לנסות להיכנס או לשנות תיקיות.
גישה לעמוד זה דורשת אישור. אתה יכול לנסות לשנות מדריכים.
Important
This feature is in Public Preview.
Sets the n-th point in the input linestring Geography or Geometry.
For the corresponding Databricks SQL function, see st_setpoint function.
Syntax
from pyspark.databricks.sql import functions as dbf
dbf.st_setpoint(col1=<col1>, col2=<col2>, col3=<col3>)
Parameters
| Parameter | Type | Description |
|---|---|---|
col1 |
pyspark.sql.Column or str |
A Geography or Geometry value representing a linestring. |
col2 |
pyspark.sql.Column or int |
A 1-based position in the linestring where the new point should be added. |
col3 |
pyspark.sql.Column or str |
A Geography or Geometry value representing a point. |
Examples
from pyspark.databricks.sql import functions as dbf
df = spark.createDataFrame([('LINESTRING(1 2,3 4)','POINT(7 8)',)], ['wkt1', 'wkt2'])
df.select(dbf.st_astext(dbf.st_setpoint(dbf.st_geomfromtext('wkt1'), 1, dbf.st_geomfromtext('wkt2'))).alias('result')).collect()
[Row(result='LINESTRING(7 8,3 4)')]
from pyspark.databricks.sql import functions as dbf
df = spark.createDataFrame([('LINESTRING ZM (1 2 3 4,5 6 7 8)','POINT M (0 9 99)',)], ['wkt1', 'wkt2'])
df.select(dbf.st_asewkt(dbf.st_setpoint(dbf.st_geogfromtext('wkt1'), -1, dbf.st_geogfromtext('wkt2'))).alias('result')).collect()
[Row(result='SRID=4326;LINESTRING ZM (1 2 3 4,0 9 0 99)')]