Flips the x-axis and y-axis of an object, swapping its X and Y coordinates.
Syntax
meshgeom ST_FlipCoordinates(meshgeom geom);
sfmesh ST_FlipCoordinates(sfmesh sfmeshObject);Parameters
| Parameter | Type | Description |
|---|---|---|
geom | meshgeom | The meshgeom object whose coordinates to flip. |
sfmeshObject | sfmesh | The sfmesh object whose coordinates to flip. |
Example
The following example constructs a meshgeom object from a JSON string and flips its x and y coordinates.
SELECT ST_AsText(
ST_FlipCoOrdinates(
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}]}'
)
)
);Output:
{"version" : 1, "root" : 0, "meshgeoms" : ["MESHGEOM(PATCH(INDEXSURFACE Z (VERTEX(0 0 2,10 0 3,10 10 1,0 10 1),INDEX((0,1,2),(1,2,3)))))"], "primitives" : [{"meshgeom" : 0}], "nodes" : [{"primitive" : 0}]}The x and y values in each VERTEX entry are swapped. For example, VERTEX(0 10 3, ...) becomes VERTEX(10 0 3, ...).