This topic describes the ST_ForcePolygonCW function. This function forces the exterior boundaries of a MultiPolygon object to be orientated in the clockwise direction and forces the interior boundaries of the MultiPolygon object to be orientated in the anticlockwise direction.

Syntax

geometry  ST_ForcePolygonCW (geometry  geom);

Parameters

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

Description

  • This function does not change a non-polygon object.
  • This function supports 3D objects and does not delete z coordinates.
  • This function supports objects that contain m coordinates.

Examples

SELECT ST_AsText(ST_ForcePolygonCW(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)