This topic describes the ST_ForceRHR function. This function forces the orientation of vertices of a polygon object to follow the Right-Hand-Rule and the area that is bounded by the polygon object is to the right of boundaries.

Syntax

geometry  ST_ForceRHR(geometry  g);

Parameters

Parameter Description
g The geometry object that you want to specify.

Description

  • The exterior rings of the polygon object are orientated in the clockwise direction, and the interior rings of the polygon object are orientated in the anticlockwise direction.
  • The ST_ForceRHR function is a synonym for the ST_ForcePolygonCW function.
  • This function supports polyhedral surfaces.
  • This function supports 3D objects and does not delete z coordinates.

Examples

SELECT ST_AsText(ST_ForceRHR(ST_GeomFromText('POLYGON((1 1,2 1,2 2,1 2,1 1))')));
           st_astext
--------------------------------
 POLYGON((1 1,1 2,2 2,2 1,1 1))
(1 row)