次の方法で共有


st_pointn

Important

この機能は パブリック プレビュー段階です

入力ライン文字列の 1 から始まる n 番目のポイントを返します。存在しない場合は None します。

対応する Databricks SQL 関数については、 st_pointn 関数を参照してください。

構文

from pyspark.databricks.sql import functions as dbf

dbf.st_pointn(col1=<col1>, col2=<col2>)

パラメーター

パラメーター タイプ Description
col1 pyspark.sql.Column または str 線の文字列を表す Geography または Geometry の値。
col2 pyspark.sql.Column または int 返されるポイントを示す行文字列内の 1 から始まる位置。

例示

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)')]