Skip to main content

st_geomfromewkt function

Applies to: check marked yes Databricks SQL check marked yes Databricks Runtime 18.0 and above check marked yes Lakehouse//RT

note

This feature is not available on Databricks SQL Classic warehouses. To learn more about Databricks SQL warehouses, see SQL warehouse types.

Parses an Extended Well-Known Text (EWKT) description of a geometry and returns the corresponding GEOMETRY value. The returned SRID is the SRID in ewktExpr if specified, or 0 otherwise.

Syntax​

st_geomfromewkt ( ewktExpr )

Arguments​

Returns​

GEOMETRY(ANY) representing the parsed EWKT geometry. The SRID is the SRID in ewktExpr if specified, or 0 otherwise. The function returns NULL if any of the inputs is NULL.

Error conditions​

Examples​

SQL
-- Simple example where the input EWKT does not include an SRID specification. The SRID of the output defaults to 0.
> SELECT st_srid(st_geomfromewkt('POINT Z (1 2 3)'));
0

-- Simple example where the input EWKT contains an SRID specification.
> SELECT concat_ws(';', st_srid(g)::STRING, st_astext(g)) FROM (SELECT st_geomfromewkt('SRID=3857;POINT Z (1 2 3)') AS g);
3857;POINT Z (1 2 3)