Categories:

Geospatial Functions, Conversion Functions

ST_GEOGRAPHYFROMWKB

Parses a WKB or EWKB input and returns a value of type GEOGRAPHY.

Aliases:

ST_GEOGFROMWKB , ST_GEOGRAPHYFROMEWKB , ST_GEOGFROMEWKB

See also:

TO_GEOGRAPHY

Syntax

ST_GEOGRAPHYFROMWKB( <varchar_or_binary_expression> )

ST_GEOGFROMWKB( <varchar_or_binary_expression> )

ST_GEOGRAPHYFROMEWKB( <varchar_or_binary_expression> )

ST_GEOGFROMEWKB( <varchar_or_binary_expression> )

Arguments

varchar_or_binary_expression

The argument must be a string or binary expression in WKB or EWKB that represents a valid geospatial object.

A string expression must be in hexadecimal format (without a leading 0x).

Returns

The function returns a value of type GEOGRAPHY.

Usage Notes

  • Issues an error if the input cannot be parsed as WKB or EWKB.

  • Issues an error if the input format is EWKB and the SRID is not 4326. See the note on EWKT and EWKB handling.

Examples

The following example returns the GEOGRAPHY object for a geospatial object described in WKT format:

-- Set the output format to WKT
alter session set GEOGRAPHY_OUTPUT_FORMAT='WKT';
select ST_GEOGRAPHYFROMWKB('01010000006666666666965EC06666666666C64240');
+-------------------------------------------------------------------+
| ST_GEOGRAPHYFROMWKB('01010000006666666666965EC06666666666C64240') |
|-------------------------------------------------------------------|
| POINT(-122.35 37.55)                                              |
+-------------------------------------------------------------------+

The following example returns the GEOGRAPHY object for a geospatial object described in EWKT format:

-- Set the output format to EWKT
alter session set GEOGRAPHY_OUTPUT_FORMAT='EWKT';
select ST_GEOGRAPHYFROMEWKB('0101000020E61000006666666666965EC06666666666C64240');
+----------------------------------------------------------------------------+
| ST_GEOGRAPHYFROMEWKB('0101000020E61000006666666666965EC06666666666C64240') |
|----------------------------------------------------------------------------|
| SRID=4326;POINT(-122.35 37.55)                                             |
+----------------------------------------------------------------------------+