共用方式為


st_startpoint

這很重要

這項功能目前處於 公開預覽版

返回輸入線串的第一個點,如果不存在,則返回None

關於對應的 Databricks SQL 函式,請參見 st_startpoint 函數

語法

from pyspark.databricks.sql import functions as dbf

dbf.st_startpoint(col=<col>)

參數

參數 類型 Description
col pyspark.sql.Columnstr 一個代表線條的 地理幾何 值。

範例

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_startpoint(dbf.st_geogfromtext('wkt'))).alias('result')).collect()
[Row(result='SRID=4326;POINT(1 2)')]
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_startpoint(dbf.st_geomfromtext('wkt', 4326))).alias('result')).collect()
[Row(result='SRID=4326;POINT ZM (1 2 3 4)')]