st_geomfromwkb
Preview
This feature is in Public Preview.
Parses the input WKB description and returns the corresponding Geometry value.
For the corresponding Databricks SQL function, see st_geomfromwkb function.
Syntax
Python
from pyspark.databricks.sql import functions as dbf
dbf.st_geomfromwkb(col1=<col1>, col2=<col2>)
Parameters
Parameter | Type | Description |
|---|---|---|
|
| A BINARY value in WKB format, representing a Geometry value. |
|
| The optional SRID value of the geometry. Default is 0. |
Examples
Python
from pyspark.databricks.sql import functions as dbf
df = spark.createDataFrame([(bytes.fromhex('010200000002000000000000000000144000000000000018400000000000001c4000000000000020c0'),)], ['wkb'])
df.select(dbf.st_asewkt(dbf.st_geomfromwkb('wkb')).alias('result')).collect()
Output
[Row(result='LINESTRING(5 6,7 -8)')]
Python
from pyspark.databricks.sql import functions as dbf
df = spark.createDataFrame([(bytes.fromhex('010200000002000000000000000000144000000000000018400000000000001c4000000000000020c0'), 4326,)], ['wkb', 'srid'])
df.select(dbf.st_asewkt(dbf.st_geomfromwkb('wkb', 'srid')).alias('result')).collect()
Output
[Row(result='SRID=4326;LINESTRING(5 6,7 -8)')]