[postgis-devel] Validity flag

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



On 15/11/2018 11:55, Sandro Santilli wrote:
> 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 ...

Ah ok. Yes, there is something to add to distinguish 2D only and 3D
validation. But I see the flags in ST_IsValid as a way to add some
exceptions to the rules. For 3D validity, we could also have
ST_Is3DValid() or sfcgal.ST_IsValid()

I am not sure about what standards say about 3D validity, probably just
a general concept without important implementation details. But I do
confirm validity in 3D is a bit more complex than in 2D: polygon points
should be on the same plane for example.

> 
>> 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. So that confirm typmod is not really important. No objection from
my side :)

> 
>> 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 ?

Hmmm, I could discuss on the last point (having an invalid flag) :)


More information about the postgis-devel mailing list