[postgis-devel] Validity flag

Sandro Santilli strk at kbt.io
Thu Nov 15 02:55:52 PST 2018


On Thu, Nov 15, 2018 at 11:21:49AM +0100, Hugo Mercier wrote:
> On 15/11/2018 11:01, Sandro Santilli wrote:
> 
> I forgot this ST_IsValid variant. Ok for using this flag for different
> kind of validity definitions. But, except for handling this ESRI bug, do
> we need other definitions of validity ?
> 
> Are you saying for example a Polygon Z with random Z would be "valid
> under the GEOS' definition of validity" ? Why is it not a bug ?

ST_IsValid is an OGC defined function. At the time it was defined, OGC
only supported 2D so ST_IsValid is 2D only. I believe it is also
documented as being 2D only. Maybe we want a flag to specify we want
3D validation. 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 ...

> I guess as many bits as there would be in headers. In the current
> version, only 2 bits is left in typmod I think.

I was asking just because I'm pretty sure we need more flagspace
for introducing validity. And we need NOT to consume all flags,
so that we can use the last available flag for specifying there
are more flags following it.

> Yes, but ST_MakeValid is allowed to modify the geometry to make it
> valid, which is not the case of ST_Validate. What if I want to mark
> valid geometries for validity without modification ?

ST_MakeValid doesn't modify an already valid geometry, so what you're
asking for is a function that will NOT TRY to fix invalid geometries,
while at the same time NOT flagging them as invalid (as you proposed
there's no INVALID flag). In which context would that be useful ?

--strk;


More information about the postgis-devel mailing list