Skip to main content
Rotates a geometry by a specified angle in radians counter-clockwise around a given origin point. The origin for rotation can be specified as either a POINT geometry or x and y coordinates. If the origin is not specified, the geometry is rotated around POINT(0 0). ST_Rotate

Signatures

ST_Rotate (geometry: Geometry, angle: Double)
ST_Rotate (geometry: Geometry, angle: Double, originX: Double, originY: Double)
ST_Rotate (geometry: Geometry, angle: Double, pointOrigin: Geometry)

Parameters

geometry
Geometry
required
The input geometry.
angle
Double
required
The angle value.
originX
Double
The origin x value.
originY
Double
The origin y value.
pointOrigin
Geometry
The point origin value.

Return type

The resulting geometry.

Example

SELECT ST_Rotate(ST_GeomFromEWKT('SRID=4326;POLYGON ((0 0, 1 0, 1 1, 0 0))'), 10, 0, 0)
SRID=4326;POLYGON ((0 0, -0.8390715290764524 -0.5440211108893698, -0.2950504181870827 -1.383092639965822, 0 0))