Pular para o conteúdo principal

st_flipcoordinates function

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

nota

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

Swaps X and Y coordinates of the input GEOMETRY value.

Syntax​

st_flipcoordinates ( geoExpr )

Arguments​

  • geoExpr: A GEOMETRY value.

Returns​

A value of type GEOMETRY with X and Y coordinates swapped.

The SRID value of the output GEOMETRY value is equal to that of the input value.

The function returns NULL if the input is NULL.

Examples​

SQL
-- Swaps X and Y coordinates of a linestring.
> SELECT st_astext(st_flipcoordinates(st_geomfromtext('LINESTRING(1 2,3 4,5 6,7 8)')));
LINESTRING(2 1,4 3,6 5,8 7)
-- Swaps X and Y coordinates of a point.
> SELECT st_astext(st_flipcoordinates(st_geomfromtext('POINT(10 20)')));
POINT(20 10)