Skip to content

ST_ROTATE

Rotates GEOGRAPHY counter-clockwise about the origin point. The rotation origin can be specified either as a POINT, or defaults to POINT(0 0).

See also:

Syntax

sql
ST_ROTATE(<input>, <rot_radians>[, <origin>])

Arguments

  • <input>: A GEOGRAPHY object to rotate
  • <rot_radians>: Rotation angle in radians (counter-clockwise)
  • <origin>: Optional GEOGRAPHY of type POINT specifying rotation center

Returns

Returns a GEOGRAPHY of the same type as the input, rotated by the specified angle.

Example

sql
SELECT ST_AsText(ST_ROTATE('POINT(1 0)'::GEOGRAPHY, pi()));
-- 'POINT(-1 0)'

SELECT ST_AsText(ST_ROTATE('POINT(1 0)'::GEOGRAPHY, pi(), 'POINT(1 0)'::GEOGRAPHY));
-- 'POINT(1 0)'