Piezīmes
Lai piekļūtu šai lapai, ir nepieciešama autorizācija. Varat mēģināt pierakstīties vai mainīt direktorijus.
Lai piekļūtu šai lapai, ir nepieciešama autorizācija. Varat mēģināt mainīt direktorijus.
Important
Support for GEOGRAPHY values is in Public Preview. Support for GEOMETRY values is generally available.
Adds a new point to the n-th position in the input linestring Geography or Geometry.
For the corresponding Databricks SQL function, see st_addpoint function.
Syntax
from pyspark.databricks.sql import functions as dbf
dbf.st_addpoint(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 str |
A Geography or Geometry value representing a point. |
col3 |
pyspark.sql.Column or int, optional |
An optional 1-based position in the linestring where the new point should be added. Default value is -1. |
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_addpoint(dbf.st_geogfromtext('wkt1'), dbf.st_geogfromtext('wkt2'), 3)).alias('result')).collect()
[Row(result='LINESTRING(1 2,3 4,7 8)')]
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_asewkt(dbf.st_addpoint(dbf.st_geogfromtext('wkt1'), dbf.st_geogfromtext('wkt2'))).alias('result')).collect()
[Row(result='SRID=4326;LINESTRING(1 2,3 4,7 8)')]
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_addpoint(dbf.st_geogfromtext('wkt1'), dbf.st_geogfromtext('wkt2'), -1)).alias('result')).collect()
[Row(result='SRID=4326;LINESTRING ZM (1 2 3 4,5 6 7 8,0 9 0 99)')]