Compartilhar via


st_geomfromgeojson

Importante

Esse recurso está em Visualização Pública.

Analisa a descrição GeoJSON e retorna o valor de Geometria correspondente.

Para consultar a função SQL correspondente do Databricks, veja st_geomfromgeojson função.

Sintaxe

from pyspark.databricks.sql import functions as dbf

dbf.st_geomfromgeojson(col=<col>)

Parâmetros

Parâmetro Tipo Description
col pyspark.sql.Column ou str Uma string no formato GeoJSON, representando um valor Geometry.

Exemplos

from pyspark.databricks.sql import functions as dbf
df = spark.createDataFrame([('{"type":"LineString","coordinates":[[5,6],[7,-8]]}',)], ['geojson'])
df.select(dbf.st_asewkt(dbf.st_geomfromgeojson('geojson')).alias('result')).collect()
[Row(result='SRID=4326;LINESTRING(5 6,7 -8)')]