[geos-devel] Polygon winding according to OGC

Sandro Santilli strk at keybit.net
Tue Sep 16 00:44:39 PDT 2014


On Mon, Sep 15, 2014 at 11:21:55PM +0300, Mika Heiskanen wrote:
> Hello Sandro,
> 
> I just checked this page:
> 
>   http://en.wikipedia.org/wiki/Well-known_text
> 
> Quote:
> 
>   It's useful to note that the OGC standard definition requires a
>   polygon to be topologically closed. It also states that if the
>   exterior linear ring of a polygon is defined in a counter clockwise
>   direction it will be seen from the "top". Any interior linear rings
>   should be defined in opposite fashion compared to the exterior ring,
>   in this case, clockwise.[1]
> 
> Strange. I did not know the winding rule could be left so arbitrary.
> However, if the statement is true, should not GEOS also enforce a
> winding rule?

Reading the actual document (06-103r4):
http://portal.opengeospatial.org/files/?artifact_id=25355

While there's a mention of this "opposite direction" for shell and holes
there's no trace of that requirement in the list of assertions that define
polygons as "valid".

That said, there's a "normalize" function in GEOS that ensures exterior
ring is clockwise and holes are counterclockwise (thus, according to the OGC
document, making the polygon be viewed from the "bottom").

--strk;

 ()  ASCII ribbon campaign  --  Keep it simple !
 /\  http://strk.keybit.net/rants/ascii_mails.txt  


More information about the geos-devel mailing list