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

Brent Wood pcreso at pcreso.com
Sun Dec 1 15:44:16 PST 2013

The same applies to a rectangle - 5 points stored instead of 4 - so where do we draw the line? 

How many vertices must a polygon have before we follow the spec & explicitly close it?

I agree that the closing vertex is redundant, & can be replaced by a bit in the header - but by doing so we lose the ability to test for is it REALLY closed, rather than just saying it is closed, perhaps less important for triangles, but a capability I'm reluctant to lose.

And as a general principle, I think dealing with polygons differently, depending on the number of vertices, is a road to be avoided. Any change should be considered at the standard level, and implemented in the application if the standard is changed. I would not like to see arbitrary changes from the standard just because :-)

Brent Wood

 From: Olivier Courtin <olivier.courtin at oslandia.com>
To: PostGIS Development Discussion <postgis-devel at lists.osgeo.org>; Mateusz Loskot <mateusz at loskot.net> 
Sent: Monday, December 2, 2013 10:50 AM
Subject: Re: [postgis-devel] OGC TIN of triangles or polygons?

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.

postgis-devel mailing list
postgis-devel at lists.osgeo.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-devel/attachments/20131201/a9a3913e/attachment.html>

More information about the postgis-devel mailing list