Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Important
This feature is in Public Preview.
Returns the input Geometry value in EWKB format.
For the corresponding Databricks SQL function, see st_asewkb function.
Syntax
from pyspark.databricks.sql import functions as dbf
dbf.st_asewkb(col1=<col1>, col2=<col2>)
Parameters
| Parameter | Type | Description |
|---|---|---|
col1 |
pyspark.sql.Column or str |
A Geometry value. |
col2 |
pyspark.sql.Column or str, optional |
The optional endianness of the output EWKB, NDR for little-endian (default) or XDR for big-endian. |
Examples
from pyspark.databricks.sql import functions as dbf
from pyspark.sql.functions import hex
df = spark.createDataFrame([('LINESTRING(1 2,3 4)',)], ['wkt'])
df.select(hex(dbf.st_asewkb(dbf.st_geomfromtext('wkt'))).alias('result')).collect()
[Row(result='010200000002000000000000000000F03F000000000000004000000000000008400000000000001040')]
from pyspark.databricks.sql import functions as dbf
from pyspark.sql.functions import hex
df = spark.createDataFrame([('LINESTRING(1 2,3 4)', 'NDR',)], ['wkt', 'e'])
df.select(hex(dbf.st_asewkb(dbf.st_geomfromtext('wkt'), df.e)).alias('result')).collect()
[Row(result='010200000002000000000000000000F03F000000000000004000000000000008400000000000001040')]
from pyspark.databricks.sql import functions as dbf
from pyspark.sql.functions import hex
df = spark.createDataFrame([('LINESTRING(1 2,3 4)',)], ['wkt'])
df.select(hex(dbf.st_asewkb(dbf.st_geomfromtext('wkt'), 'XDR')).alias('result')).collect()
[Row(result='0000000002000000023FF0000000000000400000000000000040080000000000004010000000000000')]