Polygon ring orientation

In SQL Anywhere, internal spatial operations assume outer rings of polygons are in counter-clockwise orientation and interior rings are in the opposite (clockwise) orientation.

Polygons are automatically reoriented if created with a different ring orientation than what is defined for the spatial reference system. You control polygon ring orientation by specifying a polygon format when you create the spatial reference system (for example, the POLYGON FORMAT clause of the CREATE SPATIAL REFERENCE SYSTEM statement).

For example, suppose your spatial reference system defines the polygon format as counter-clockwise (the default). If you create a polygon and specify the points in a clockwise order Polygon((0 0, 5 10, 10 0, 0 0), (4 2, 4 4, 6 4, 6 2, 4 2)), the database server automatically rearranges the points to be in counter-clockwise rotation, as follows: Polygon((0 0, 10 0, 5 10, 0 0), (4 2, 4 4, 6 4, 6 2, 4 2)).

Triangle with arrows along the edge pointing counter-clockwise - this is the outer ring. Inside the triangle is a square with arrows along its edge pointing clockwise. This is the inner ring.

If the inner ring was specified before the outer ring, the outer ring would appear as the first ring

In order for polygon reorientation to work in round-Earth spatial reference systems, polygons are limited to 160° in diameter.

 See also