[postgis-users] WKT polygon and interior ring orientation

Mark Cave-Ayland mark.cave-ayland at siriusit.co.uk
Mon Nov 3 05:21:04 PST 2008


Kevin Neufeld wrote:
> If you look at the OGC spec v.1.1.0 and the current v1.2.0, Part 2, the 
> only reference to orientation is in a footnote, "Polygon rotation is not 
> defined by this specification; actual polygon rotation may be in a 
> clockwise or counter-clockwise direction."
> 
> Prior versions don't even mention orientation.
> 
> http://www.opengeospatial.org/standards/sfs
> 
> It's my understanding that polygon orientation doesn't really matter and 
> even varies from one database vendor to another.  Martin Davis may be 
> able to answer the whys better, but since the specs didn't specify at 
> the time, I believe JTS/GEOS chose to follow the somewhat more accepted 
> orientation and follow the Right-Hand-Rule - that is, the orientation of 
> the rings are such that the thing they are bounding is to the right.  In 
> particular, an exterior ring is clockwise and interior rings are counter 
> clockwise.  PostGIS even has a forceRHR for polygons ... but like I 
> said, I don't think it really matters.
> 
> -- Kevin

I vaguely remember reading somewhere that if you are trying to calculate 
normals to a plane (or something similar) then you must have the rings 
in the same orientation. Now the interesting thing to notice is the 
MS-SQL's geometry type enforces ring orientation, so we can only guess 
that they need this property for some of their spherical calculations.


ATB,

Mark.

-- 
Mark Cave-Ayland
Sirius Corporation - The Open Source Experts
http://www.siriusit.co.uk
T: +44 870 608 0063



More information about the postgis-users mailing list