Categories:

Geospatial Functions, Conversion Functions

ST_GEOGRAPHYFROMWKT

Parses a WKT or EWKT input and returns a value of type GEOGRAPHY.

Aliases:

ST_GEOGFROMWKT , ST_GEOGRAPHYFROMEWKT , ST_GEOGFROMEWKT , ST_GEOGRAPHYFROMTEXT , ST_GEOGFROMTEXT

See also:

TO_GEOGRAPHY

Syntax

ST_GEOGRAPHYFROMWKT( <varchar_expression> )

ST_GEOGFROMWKT( <varchar_expression> )

ST_GEOGRAPHYFROMEWKT( <varchar_expression> )

ST_GEOGFROMEWKT( <varchar_expression> )

ST_GEOGRAPHYFROMTEXT( <varchar_expression> )

ST_GEOGFROMTEXT( <varchar_expression> )

Arguments

varchar_expression

The argument must be a string expression in WKT or EWKT that represents a valid geospatial object.

Returns

The function returns a value of type GEOGRAPHY.

Usage Notes

  • Issues an error if the input cannot be parsed as WKT or EWKT.

  • Issues an error if the input format is EWKT 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_GEOGRAPHYFROMWKT('POINT(-122.35 37.55)');
+---------------------------------------------+
| ST_GEOGRAPHYFROMWKT('POINT(-122.35 37.55)') |
|---------------------------------------------|
| 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_GEOGRAPHYFROMEWKT('SRID=4326;POINT(-122.35 37.55)');
+--------------------------------------------------------+
| ST_GEOGRAPHYFROMEWKT('SRID=4326;POINT(-122.35 37.55)') |
|--------------------------------------------------------|
| SRID=4326;POINT(-122.35 37.55)                         |
+--------------------------------------------------------+