Share via


st_rotate function

Applies to: check marked yes Databricks Runtime 17.1 and above

Important

This feature is in Public Preview.

Rotates the input GEOMETRY around the Z axis by the given rotation angle (in radians).

Syntax

st_rotate ( geoExpr, rotationAngle )

Arguments

  • geoExpr: A GEOMETRY value.
  • rotationAngle: A DOUBLE value representing the rotation angle (in radians).

Returns

A value of type GEOMETRY, representing the rotated geometry.

The SRID value of the output GEOMETRY value is equal to that of the input value.

The dimension of the output GEOMETRY value is the same as that of the input value.

The function returns NULL if any of the inputs is NULL.

Examples

-- Rotate a point around the Z axis by 90 degrees (i.e. pi/2 radians).
> SELECT st_astext(st_rotate(st_geomfromtext('POINT ZM (3 -2 40 27)'), pi() / 2))
  POINT ZM (2 3 40 27)