[postgis-users] WKT polygon and interior ring orientation

Sufficool, Stanley ssufficool at rov.sbcounty.gov
Mon Nov 3 08:32:04 PST 2008



> -----Original Message-----
> From: postgis-users-bounces at postgis.refractions.net 
> [mailto:postgis-users-bounces at postgis.refractions.net] On 
> Behalf Of Mark Cave-Ayland
> Sent: Monday, November 03, 2008 5:21 AM
> To: PostGIS Users Discussion
> Subject: Re: [postgis-users] WKT polygon and interior ring orientation
> 
> 
> 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.
> 

I assume you mean GEOGRAPHY type. The SQL 2008 GEOMETRY type does not
suport spheroid projections/calculations.

Does ring orientation matter when you are calculating point in poly?
When you calc a point in poly, do you take the sum of vertex angles from
point to poly vertex and if sum of angles is >= 360 then point is in
poly?


> 
> ATB,
> 
> Mark.
> 
> -- 
> Mark Cave-Ayland
> Sirius Corporation - The Open Source Experts http://www.siriusit.co.uk
> T: +44 870 608 0063 _______________________________________________
> postgis-users mailing list postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
> 



More information about the postgis-users mailing list