ST_RotateZ

更新时间:
复制 MD 格式

Rotates a geometry along the Z-axis by the specified angle in radians.

Syntax

geometry ST_RotateZ(geometry geomA, float rotRadians);

Parameters

ParameterDescription
geomAThe geometry object to rotate.
rotRadiansThe rotation angle, in radians.

Description

ST_RotateZ(geomA, rotRadians) is shorthand for ST_Affine(geomA, 1, 0, 0, 0, cos(rotRadians), -sin(rotRadians), 0, sin(rotRadians), cos(rotRadians), 0, 0, 0).

This function supports circular strings, curves, polyhedral surfaces, triangles, TIN (Triangulated Irregular Network) surfaces, and 3D geometries.

Examples

SELECT ST_AsEWKT(ST_RotateZ('LINESTRING (1 2 1,2 2 1)'::geometry, pi()));

Output:

          st_asewkt
-----------------------------
 LINESTRING(-1 -2 1,-2 -2 1)
(1 row)