[postgis-devel] OGC TIN of triangles or polygons?

Olivier Courtin olivier.courtin at oslandia.com
Sun Dec 1 13:50:47 PST 2013

On Nov 28, 2013, at 12:55 PM, Mateusz Loskot wrote:

Hi Mateusz,

> """
> A Triangle is a polygon with 3 distinct, non-collinear vertices
> """
> If a triangle must have exactly 3 points and all points must be distinct,
> as I interpret what the space says above, why PostGIS generates 4 points?
> Attempt to parse WKT with 3-point triangles, as OGC specifies:
> TIN (((0 0, 0 1, 1 0)), ((0 1, 1 1, 1 0)))
> generates:
> ERROR:  triangle must have exactly 4 points
> Is that right?

Triangle is a surface in OGC SFS 1.2 model.
And so closing coordinates are required. (cf in SFS 1.2 common part)

So it's imply (as i understand it) 3 coordinates points and 1 more to close it (so 4)

One other discussion could be, is it really smart to store the closing point for a TRIANGLE ?
(and not to just use a is_closed flag, in geometry header for instance)
As it could lead to save significant storage space.

> Is it my misunderstanding or from an implementer point,
> OGC SFS 1.2.1 is inconsistent in regard to specification of TIN,
> triangle and polygon and use of those types in the WKT/WKB formats.
> And, the buggy WKBTIN format in the OGC SFS 1.2.1 should be corrected this way:
> byte byteOrder;
> static uint32 wkbType = 17;
> uint32 numTriangles;
> WKBTriangle triangles[numTriangles]
> }

I agree, 
and, as you seen, it was implemented in PostGIS in this way.

On the other side, never spend time/energy to interact with OGC WG to clean it up/clarify it.
Worth to check it in coming OGC SFS standard.


More information about the postgis-devel mailing list