WL#10926: Ellipsoidal ST_IsValid
ST_IsValid currently only supports computations in Cartesian spatial reference systems (SRSs). This WL extends ST_IsValid to detect that its parameter is in a geographic (ellipsoidal) SRS and to compute on the ellipsoid.
Projected SRSs and SRID 0 will still return the same result as before. If the SRID refers to a geographic SRS, the result will be different.
The ST_IsValid function will be implemented as described in SQL/MM Part 3 Spatial (ISO/IEC 13249-3:2015), Sect. 5.1.10.
- F-1
- ST_IsValid MUST return NULL if its argument is NULL.
- F-2
- ST_IsValid MUST NOT return NULL if its argument is not NULL.
- F-3
- If the argument is not a syntactically well-formed geometry, ST_IsValid MUST raise ER_GIS_INVALID_DATA during function evaluation.
- F-4
- ST_IsValid MUST return 1 if its argument is an empty geometry.
- F-5
- If the argument is geometrically valid, ST_IsValid MUST return 1.
- F-6
- If the argument is geometrically invalid, ST_IsValid MUST return 0.
- F-7
- If the argument is a geometry in a geographic SRS and a longitude value is not in the range (-180,180] (in degrees -- other limits in other units), ST_IsValid MUST raise ER_LONGITUDE_OUT_OF_RANGE.(*)
- F-8
- If the argument is a geometry in a geographic SRS and a latitude value is not in the range [-90,90] (in degrees -- other limits in other units), ST_IsValid MUST raise ER_LATITUDE_OUT_OF_RANGE.(*)
- NF-1
- The function MUST be non-nullable if the argument is non-nullable.
- NF-2
- The function MUST be nullable if the argument is nullable.
(*) The exact limits will deviate slightly because of floating point arithmetics.
- I-1
- No new files.
- I-2
- No new syntax.
- I-3
- No new commands.
- I-4
- No new tools.
- I-5
- The semantics of interface SQL01 are changed: If the geometry is in a geographic SRS, ST_IsValid will return a result based on geographical computations. Other computations will remain as they are today.
- I-6
- No new errors or warnings.
Modify Item_func_isvalid and implement the desired behavior in function val_int(). Update function resolve_type() to set maybe_null only if the parameter is nullable.
Create a functor gis::Is_valid and a function gis::is_valid() in sql/gis/is_valid.{h,cc} after the model of gis::distance(), gis::within(), etc., that computes the validity using Boost.Geometry.