지리 공간 함수, 변환 함수


Parses an input and returns a value of type GEOMETRY.

This function is essentially identical to TO_GEOMETRY except that it returns NULL when TO_GEOMETRY would issue an error.

See also:



Use one of the following:

TRY_TO_GEOMETRY( <varchar_expression> )

TRY_TO_GEOMETRY( <binary_expression> )

TRY_TO_GEOMETRY( <variant_expression> )



The argument must be a string expression that represents a valid geometric object in one of the following formats:

  • WKT (well-known text).

  • WKB (well-known binary) in hexadecimal format (without a leading 0x).

  • EWKT (extended well-known text).

  • EWKB (extended well-known binary) in hexadecimal format (without a leading 0x).

  • GeoJSON.


The argument must be a binary expression in WKB or EWKB format.


The argument must be an OBJECT in GeoJSON format.


The function returns a value of type GEOMETRY.

Usage Notes

  • Returns NULL if the input cannot be parsed as the appropriate supported format (WKT, WKB, EWKT, EWKB, GeoJSON).

  • For GeoJSON, WKT, and WKB input, the resulting GEOMETRY object has SRID set to 0. To change the SRID, pass the GEOMETRY object to ST_SETSRID, specifying the SRID that you want to set. ST_SETSRID returns the GEOMETRY object with that SRID set.


This shows a simple use of the TRY_TO_GEOMETRY function with VARCHAR data:

select try_to_geometry('INVALID INPUT');
| try_to_geometry('INVALID INPUT')     |
| NULL                                 |
맨 위로 이동