Swaps two coordinate ordinates in a geometry object.
Syntax
geometry ST_SwapOrdinates(geometry geom, cstring ords);Parameters
| Parameter | Description |
|---|---|
geom | The geometry object whose coordinates to swap. |
ords | The two ordinates to swap. A 2-character string composed of any two of the following characters: x, y, z, m. |
Usage notes
Supports circular strings, curves, polyhedral surfaces, triangles, and triangulated irregular network (TIN) surfaces.
Preserves z coordinates in 3D objects — no ordinate is dropped.
Supports m coordinates.
Examples
Swap the x and y ordinates of a point:
SELECT ST_AsText(ST_SwapOrdinates('POINT(1 0)'::geometry, 'xy'));Output:
st_astext
------------
POINT(0 1)
(1 row)该文章对您有帮助吗?