TO_GEOMETRY

functionpartialCore SQL functions

docs.snowflake.com ↗

Geospatial functionsConversion functions

Parses an input and returns a value of type GEOMETRY.

Syntax

supportedpartialnot supportednot scored

Use one of the following

TO_GEOMETRY( <varchar_expression> [ , <srid> ] [ , <allow_invalid> ] )

TO_GEOMETRY( <binary_expression> [ , <srid> ] [ , <allow_invalid> ] )

TO_GEOMETRY( <variant_expression> [ , <srid> ] [ , <allow_invalid> ] )

TO_GEOMETRY( <geography_expression> [ , <srid> ] [ , <allow_invalid> ] )

Parameters

NameRequiredDescription
varchar_expressionrequiredThe 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
binary_expressionrequiredThe argument must be a binary expression in WKB or EWKB format.
variant_expressionrequiredThe argument must be an OBJECT in GeoJSON format.
geography_expressionrequiredThe argument must be an expression of type GEOGRAPHY.
sridoptionalThe integer value of the SRID to use.
allow_invalidoptionalIf TRUE, specifies that the function returns a GEOGRAPHY or GEOMETRY object, even when the input shape isn’t valid and can’t be repaired. For more information, see Specifying how invalid geospatial shapes are handled.

Returns

The function returns a value of type GEOMETRY.

Usage notes

Known gaps

Parts not fully supported, and recorded divergences from Snowflake.

See also

Referenced by