Categories:

Geospatial Functions

ST_ASEWKB

Given a value of type GEOGRAPHY, return the binary representation of that value in EWKB (extended well-known binary) format.

See also:

ST_ASWKB

Syntax

ST_ASEWKB( <geography_expression> )

Arguments

geography_expression

The argument must be an expression of type GEOGRAPHY.

Returns

A value of type BINARY.

Usage Notes

Examples

The following example demonstrates the ST_ASEWKB function. For the EWKB output, it is assumed that the BINARY_OUTPUT_FORMAT parameter is set to HEX (the default value for the parameter).

create table geospatial_table (g GEOGRAPHY);
insert into geospatial_table values
    ('POINT(-122.35 37.55)'), ('LINESTRING(-124.20 42.00, -120.01 41.99)');
select st_asewkb(g)
    from geospatial_table;
+--------------------------------------------------------------------------------------------+
| ST_ASEWKB(G)                                                                               |
|--------------------------------------------------------------------------------------------|
| 0101000020E61000006666666666965EC06666666666C64240                                         |
| 0102000020E610000002000000CDCCCCCCCC0C5FC00000000000004540713D0AD7A3005EC01F85EB51B8FE4440 |
+--------------------------------------------------------------------------------------------+