[postgis-devel] Validity flag

Hugo Mercier hugo.mercier at oslandia.com
Thu Nov 15 03:39:32 PST 2018



On 15/11/2018 12:29, Even Rouault wrote:
>> Does OGC (or ISO) today say what makes a 3D geometry
>> valid ? I'm guessing it's not just a matching Z for first and last
>> point in a ring ...
> 
> OGC 06-103r4 Simple Feature Access Part 1 v1.2.1 [1] mentions in §6.1.11.1 : 
> "A Polygon is a planar Surface....". And SQL/MM-Part3 [2] says the same thing 
> in §8.3.1: "The ST_Polygon type is a subtype of the ST_Curve Polygon type and 
> represents a planar surface..."

Ah thanks for pointing to the authoritative references.

> 
> The notion of planar surface isn't defined in those docs. Presumably in 
> others. But I guess it means that the (x,y,z) coordinates of the vertex much 
> be solutions of an equation ax + by + cz + d = 0

Indeed. And implementations usually introduce here a small tolerance,
because in the general case, point coordinates in floating points cannot
be on the same 3D plane (which is a similar problem as a point generally
does not intersect a line, except on trivial cases).

This is what we do in SFCGAL: there is a 1e-9 tolerance somewhere to
test for the planarity of polygons. But this should be fixed I think by
either no tolerance at all (i.e. working with floating points) or taking
a tolerance based on the precision model.

> 
> Even
> 
> [1] http://portal.opengeospatial.org/files/?artifact_id=25355
> [2] http://jtc1sc32.org/doc/N1101-1150/32N1107-WD13249-3--spatial.pdf
> 


More information about the postgis-devel mailing list