You are viewing documentation about an older version (1.40.0). View latest version

snowflake.snowpark.functions.st_asewkb

snowflake.snowpark.functions.st_asewkb(geography_or_geometry_expression: Union[snowflake.snowpark.column.Column, str]) Column[source]

Returns the Extended Well-Known Binary (EWKB) representation of a GEOGRAPHY or GEOMETRY object.

Parameters:

geography_or_geometry_expression (ColumnOrName) – The GEOGRAPHY or GEOMETRY objects to convert to EWKB format

Returns:

The EWKB representation as binary data

Return type:

Column

Examples::
>>> from snowflake.snowpark.functions import to_geography, col
>>> from snowflake.snowpark import Row
>>> df = session.create_dataframe([
...     ['POINT(-122.35 37.55)'],
...     ['LINESTRING(-124.20 42.00, -120.01 41.99)']
... ], schema=["g"])
>>> df.select(st_asewkb(to_geography(col("g"))).alias("ewkb")).collect()
[Row(EWKB=bytearray(b'\x01\x01\x00\x00 \xe6\x10\x00\x00fffff\x96^\xc0fffff\xc6B@')), Row(EWKB=bytearray(b'\x01\x02\x00\x00 \xe6\x10\x00\x00\x02\x00\x00\x00\xcd\xcc\xcc\xcc\xcc\x0c_\xc0\x00\x00\x00\x00\x00\x00E@q=\n\xd7\xa3\x00^\xc0\x1f\x85\xebQ\xb8\xfeD@'))]
Copy