ST_RotateZ — Rotates a geometry, an Angle (in radians), around the Z axis.
bytea ST_RotateZ(
bytea
Geometry, double
AngleRadians)
;
Rotates a geometry, an Angle (in radians), around the Z axis. In the following table transformation matrices and equations to transform the vertices are shown.
Transformation matrix | Equations to transform the vertices |
ST_RotateZ (geomA, rotRadians) is an abreviation for the method: ST_Affine(geomA, cos(rotRadians), -sin(rotRadians), 0, sin(rotRadians), cos(rotRadians), 0, 0, 0, 1, 0, 0, 0) |
2D | 3D | M |
---|---|---|
OGC SFS for SQL. 1.1 (1999) | OGC SFS for SQL. 1.1.0 (2005) | OGC SFS for SQL. 1.2.0 (2006) | SQL-MM Part 3 |
---|---|---|---|
- | - | - | - |
--Rotates 180º a 4D Point SELECT ST_AsEWKT(ST_RotateZ(ST_GeomFromEWKT('POINT (1 2.5 3 4)'),pi())); --Result POINT (-1 -2.5 3 4) --Rotates 90º SELECT ST_AsEWKT(ST_Rotate(ST_GeomFromEWKT('LINESTRING (10 10 15, 5 2 10)'),pi()/2)); --Result LINESTRING (-10 10 15, -2 5 10) --Same Rotation with ST_Affine SELECT ST_AsEWKT(ST_Affine(geomA, cos(rotRadians), -sin(rotRadians), 0, sin(rotRadians), cos(rotRadians), 0, 0, 0, 1, 0, 0, 0)) FROM (SELECT ST_GeomFromEWKT('LINESTRING (10 10 15, 5 2 10)') as geomA, pi()/2 as rotRadians) as foo; --Result LINESTRING (-10 10 15, -2 5 10)