Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Applies to: Databricks Runtime 17.1 and above
Important
This feature is in Public Preview.
Swaps X and Y coordinates of the input geometry.
Syntax
st_flipcoordinates ( geoExpr )
Arguments
geoExpr
: AGEOMETRY
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
-- 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)