pyspark.sql.functions.st_geomfromwkb#

pyspark.sql.functions.st_geomfromwkb(wkb)[source]#

Parses the input WKB description and returns the corresponding GEOMETRY value.

New in version 4.1.0.

Parameters
wkbColumn or str

A BINARY value in WKB format, representing a GEOMETRY value.

Examples

>>> from pyspark.sql import functions as sf
>>> df = spark.createDataFrame([(bytes.fromhex('0101000000000000000000F03F0000000000000040'),)], ['wkb'])  # noqa
>>> df.select(sf.hex(sf.st_asbinary(sf.st_geomfromwkb('wkb'))).alias('result')).collect()
[Row(result='0101000000000000000000F03F0000000000000040')]