[postgis-devel] Minimum number of points in a POLYGON ring?

Kevin Neufeld kneufeld at refractions.net
Thu Sep 18 09:03:10 PDT 2008


My my readings, according to OGC, the number of points is vague, but the 
ruleset is specific.  A Polygon is made up of a set of LinearRings 
(following a set of rules about how they relate to eachother).  A 
LinearRing is a LineString that is both closed (startpoint ~= endpoint) 
and simple (does not self-intersect).  This implies that a linear ring 
must be made up of at least 4 points (3 distinct points) to avoid 
self-intersection.

So the parser check should probably be increased the check to 4, but 
making sure the endpoints are equal (thus 3 distinct points).

Does that help?
-- Kevin

Mark Cave-Ayland wrote:
> Hi there,
> 
> Having just been working on the parser again, I've just wanted to verify 
> we are currently doing the check for the minimum number of points in a 
> polygon ring correctly.
> 
> Currently the parser enforces a minimum of 3 points in a ring - but 
> given that the last point in a ring must be the same as the first point, 
> do we need to increase this to 4? So in other words, is a polygon with 
> no area simple?
> 
> A bit of googling shows Informix believes the minimum number of points 
> in a polygon should be 4 (see USE31 in 
> http://publib.boulder.ibm.com/infocenter/idshelp/v10/index.jsp?topic=/com.ibm.spatial.doc/spat310.htm), 
> but that doesn't distinguish between whether that is for the whole 
> polygon or just an individual ring. Can anyone clarify this with the OGC 
> spec?
> 
> 
> Many thanks,
> 
> Mark.
> 



More information about the postgis-devel mailing list