st_geomfromewkt function
Applies to: Databricks SQL
Databricks Runtime 18.0 and above
Lakehouse//RT
注記
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
ewktExpr: ASTRINGvalue, representing a geometry in Extended WKT (EWKT) format.
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
- If the value of
ewktExpris an invalid Extended WKT (EWKT) description, the function returns EWKT_PARSE_ERROR.
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)
Related functions
st_asbinaryfunctionst_asewkbfunctionst_asewktfunctionst_asgeojsonfunctionst_astextfunctionst_geogfromewktfunctionst_geogfromgeojsonfunctionst_geogfromtextfunctionst_geogfromwkbfunctionst_geogfromwktfunctionst_geomfromewkbfunctionst_geomfromgeojsonfunctionst_geomfromtextfunctionst_geomfromwkbfunctionst_geomfromwktfunctionto_geographyfunctionto_geometryfunctiontry_to_geographyfunctiontry_to_geometryfunction