Bug #117076 ST_Intersection returns a non-empty result for two geometries that are disjoint.
Submitted: 30 Dec 2024 13:38 Modified: 30 Dec 2024 13:49
Reporter: shijie li Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: GIS Severity:S2 (Serious)
Version:8.0.40 OS:Any
Assigned to: CPU Architecture:Any

[30 Dec 2024 13:38] shijie li
Description:
When processing geometric objects with five decimal precision, the ST_Intersection() returns a non empty result for two disjoint geometric objects.

How to repeat:
DROP table if EXISTS t1;
DROP table if EXISTS t2;
CREATE TABLE t1(geom geometry NOT NULL);
CREATE TABLE t2(geom geometry NOT NULL);
INSERT INTO t1 (geom) VALUES(ST_GeomFromText('POLYGON ((446 -207, 315 -75.99999, 557 -76, 446 -207))'));
INSERT INTO t2 (geom) VALUES(ST_GeomFromText('POLYGON ((184 -207, 315 -76, 446 -208, 315 -338, 184 -207))'));

SELECT ST_AsText(ST_Intersection(t1.geom,t2.geom)),ST_Disjoint(t1.geom, t2.geom) FROM t1, t2;

--expected:{NULL,1}
--actual  :{POINT(315 -76),1}

Please let me know if you will fix this bug. Thank you.

Suggested fix:
The calculation result of 'Intersects\Disjoint' predicates is correct, so it can be considered to first determine whether they intersect before calculating the intersection.
[30 Dec 2024 13:41] shijie li
Please review the five verified bugs I submitted a few days ago and I would like to know if you will fix them too.
Thanks again!
[30 Dec 2024 13:49] MySQL Verification Team
Hello shijie li,

Thank you for the report and feedback.

regards,
Umesh