名称

ST_ForcePolygonCW — 顺时针方向调整所有外环,逆时针方向调整所有内环。

大纲

geometry ST_ForcePolygonCW(geometry geom);

描述

强制(多)多边形对其外环使用顺时针方向,对其内环使用逆时针方向。 非多边形几何体原封不动地返回。

可用性:2.4.0

该函数支持 3d 并且不会丢失 z-index。

该功能支持M坐标。

示例

Force a polygon and its hole to use clockwise exterior rings and counter-clockwise interior rings.

Code
WITH data AS (
  SELECT 'POLYGON((0 0,4 0,4 4,0 4,0 0),
                  (1 1,1 3,3 3,3 1,1 1))'::geometry AS geom
)
SELECT geom AS input_polygon,
       ST_ForcePolygonCW(geom) AS cw_polygon
FROM data;
栅格输出
POLYGON((0 0,4 0,4 4,0 4,0 0),(1 1,1 3,3 3,3 1,1 1)) | POLYGON((0 0,0 4,4 4,4 0,0 0),(1 1,3 1,3 3,1 3,1 1))
Figure
Geometry figure for visual-st-forcepolygoncw-01