This topic describes the ST_SwapOrdinates function. This function swaps the specified coordinates of a meshgeom or sfmesh object.

Syntax

meshgeom  ST_SwapOrdinates(meshgeom  geom , cstring  ords);
sfmesh    ST_SwapOrdinates(sfmesh  sfmeshObject, cstring  ords);

Parameters

ParameterDescription
geomThe meshgeom object.
sfmeshObjectThe sfmesh object.
ordsThe coordinates that you want to swap. The value is a string that consists of any two of the following letters: x, y, z, and m.

Description

This function supports 3D objects and does not delete z coordinates.

This function supports m coordinates.

Examples

SELECT ST_AsText(ST_SwapOrdinates(ST_MeshFromText('{"version" : 1, "root" : 0, "meshgeoms" : ["MESHGEOM(PATCH(INDEXSURFACE Z (VERTEX(0 0 2,0 10 3,10 10 1,10 0 1),INDEX((0,1,2),(1,2,3)))))"], "primitives" : [{"meshgeom" : 0}], "nodes" : [{"primitive" : 0}]}'), 'xz'));

-------------
{"version" : 1, "root" : 0, "meshgeoms" : ["MESHGEOM(PATCH(INDEXSURFACE Z (VERTEX(2 0 0,3 10 0,1 10
 10,1 0 10),INDEX((0,1,2),(1,2,3)))))"], "primitives" : [{"meshgeom" : 0}], "nodes" : [{"primitive"
: 0}]}