Aller au contenu principal

st_dump

Renvoie un tableau contenant les géométries individuelles dans la géométrie d'entrée.

Pour la fonction Databricks SQL correspondante, consultez la fonctionst_dump.

Syntaxe

Python
from pyspark.databricks.sql import functions as dbf

dbf.st_dump(col=<col>)

parameter

parameter

Type

Description

col

pyspark.sql.Column OU str

Une valeur de géométrie.

parameter

Type

Description

col

pyspark.sql.Column OU str

Une valeur de géométrie.

Exemples

Python
from pyspark.databricks.sql import functions as dbf
df = spark.createDataFrame([('MULTILINESTRING((1 2,3 4),(7 8,6 5))',)], ['wkt'])
df.select(dbf.st_asewkt(dbf.explode(dbf.st_dump(dbf.st_geomfromtext('wkt', 3857)))).alias('result')).collect()
Output
[Row(result='SRID=3857;LINESTRING(1 2,3 4)'), Row(result='SRID=3857;LINESTRING(7 8,6 5)')]
Python
from pyspark.databricks.sql import functions as dbf
df = spark.createDataFrame([('GEOMETRYCOLLECTION(POINT EMPTY,MULTIPOINT(5 6,EMPTY,3 4))',)], ['wkt'])
df.select(dbf.st_astext(dbf.explode(dbf.st_dump(dbf.st_geomfromtext('wkt')))).alias('result')).collect()
Output
[Row(result='POINT EMPTY'), Row(result='POINT EMPTY'), Row(result='POINT(3 4)'), Row(result='POINT(5 6)')]