This topic describes the ST_SwapOrdinates function. This function swaps the specified coordinates of a geometry object.


geometry  ST_SwapOrdinates(geometry  geom , cstring  ords);


Parameter Description
geom The geometry object that you want to specify.
ords The coordinates that you want to swap. The value of this parameter is a 2-character string. Valid values: x, y, z, and m.


  • This function supports circular strings, curves, polyhedral surfaces, triangles, and triangulated irregular network (TIN) surfaces.
  • The ST_SwapOrdinates function supports 3D objects and does not delete z coordinates.
  • The ST_SwapOrdinates function supports m coordinates.


Process a geometry object by using the default parameter settings.
SELECT ST_AsText(ST_SwapOrdinates('POINT(1 0)'::geometry,'xy'));
 POINT(0 1)
(1 row)