WL#7541: GIS MBR spatial operations enhancement
MBR operations for GIS is very essential, existing GIS MBR support is mostly OK, although there are things that can be improved, issues I've found currently including: 1. Some mbr functions are wired to the wrong Item_func, including 'mbrtouches', and 'touches', which are implemented not using a geometry's mbr but using the geometry itself. 2. Fix mbrwithin/mbrtouches, they didn't return correct results when one or both mbrs degrade to a point/line segment. 3. We need a few new MBR relation check functions.
F-1: MBRTOUCHES function should do the 'touches' spatial relation checking using two geometries' MBR boxes, not using the geometry itself. F-2: Fix mbrtouches and mbrwithin bugs: they returned wrong results when one or both of the mbr arguments degrade to a point or horizontal/vertical line segment. Fix the bugs according to OGC definition for touches and within. With changes of this WL applied, when a point lies on the boundary of a line segment or polygon, or when a line segment lies totally on the boundary of a polygon, it's not considered 'within' but 'touches' instead; and two identical points will not be considered 'touches' with changes of this WL applied. F-3: Add 'mbrequals' as another name for 'mbrequal', because we have 'equals' and 'st_equals', but 'mbrequal' doesn't follow the same naming convention. And also deprecate mbrequal. F-4: Add 'mbrcoveredby', and 'mbrcovers' GEOM_1 MBRCOVERS GEOM_2 if any only if the MBR of GEOM_2 lies within or on the boarder of the MBR of GEOM_1; The DE-9IM definition for COVERS is: (II AND ~EI AND ~EB) OR (IB AND ~EI AND ~EB) OR (BI AND ~EI AND ~EB) OR (BB AND ~EI AND ~EB) and the two checks are opposite: GEOM_1 MBRCOVERS GEOM2 <=> GEOM_2 MBRCOVEREDBY GEOM_1 F-5: MBRCOVERS and MBRCOVEREDBY MUST return NULL if either argument is NULL or an empty geometry; F-6: MBRCOVERS and MBRCOVEREDBY MUST NOT return NULL if neither arguments are NULL or empty geometry. F-7: MBRCOVERS and MBRCOVEREDBY MAY allow invalid geometry arguments, the invalidity is according to OGC specifications. F-8: MBRCOVERS and MBRCOVEREDBY SHOULD report ER_GIS_INVALID_DATA if either arguments are not valid GEOMETRY byte string. and they SHOULD not report any other error.
Changes to the interface specification: I-1: No new files. I-2: New syntax: Two new functions: <BOOL> = MBRCOVEREDBY(<string>, <string>); <BOOL> = MBRCOVERS(<string>, <string>); Here the <string> is a byte string of GEOMETRY (SRID+WKB) format. I-3: No new commands. I-4: No new tools. I-5: No impact on existing functionality.
1. Wire up mbrtouches to Item_func_spatial_mbr_rel to call MBR::touches. 2. Add creators for the two new GIS functions of F-4. 3. Implement the two new GIS functions according to F-4 ~ F-8. 4. Fix bugs of MBR::within and MBR::touches, basically they need to consider degraded polygon --- a point, or a vertical/horizontal line segment.
Copyright (c) 2000, 2019, Oracle Corporation and/or its affiliates. All rights reserved.