Lưu ý
Cần có ủy quyền mới truy nhập được vào trang này. Bạn có thể thử đăng nhập hoặc thay đổi thư mục.
Cần có ủy quyền mới truy nhập được vào trang này. Bạn có thể thử thay đổi thư mục.
Important
This feature is in Public Preview.
Returns the 1-based n-th point of the input linestring, or None if it doesn't exist.
For the corresponding Databricks SQL function, see st_pointn function.
Syntax
from pyspark.databricks.sql import functions as dbf
dbf.st_pointn(col1=<col1>, col2=<col2>)
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 indicating the point that should be returned. |
Examples
from pyspark.databricks.sql import functions as dbf
df = spark.createDataFrame([('LINESTRING(1 2,3 4,5 6)',)], ['wkt'])
df.select(dbf.st_asewkt(dbf.st_pointn(dbf.st_geogfromtext('wkt'), 3)).alias('result')).collect()
[Row(result='SRID=4326;POINT(5 6)')]
from pyspark.databricks.sql import functions as dbf
df = spark.createDataFrame([('LINESTRING ZM (1 2 3 4,5 6 7 8)',)], ['wkt'])
df.select(dbf.st_asewkt(dbf.st_pointn(dbf.st_geomfromtext('wkt', 4326), -2)).alias('result')).collect()
[Row(result='SRID=4326;POINT ZM (1 2 3 4)')]