Partager via


st_pointn

Important

Cette fonctionnalité est disponible en préversion publique.

Retourne le n-ième point de base de la chaîne de ligne d’entrée, ou None s’il n’existe pas.

Pour la fonction SQL Databricks correspondante, consultez st_pointn.

Syntaxe

from pyspark.databricks.sql import functions as dbf

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

Paramètres

Paramètre Type Descriptif
col1 pyspark.sql.Column ou str Valeur Geography ou Geometry représentant une chaîne de ligne.
col2 pyspark.sql.Column ou int Position basée sur 1 dans la chaîne de ligne indiquant le point qui doit être retourné.

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