Skip to content

Latest commit

 

History

History
32 lines (26 loc) · 1.19 KB

23.md

File metadata and controls

32 lines (26 loc) · 1.19 KB

Consider the following statements:

SET @g1 = ST_GeomFromText('MULTILINESTRING((280 990,20 100))');
SET @g2 = ST_GeomFromText('GEOMETRYCOLLECTION(MULTILINESTRING((280 990,20 100)),POLYGON((60 360,620 850,420 850,60 360)))');

SELECT ST_Crosses(@g1, @g2);
-- result{0}
SELECT ST_Crosses(ST_SwapXY(@g1), ST_SwapXY(@g2));
-- expected {0}; actual {1}

After swapping the X and Y coordinates, MySQL GIS gives the incorrect answer.

LineString g1 doesn't cross g2 because g2 covers g1, according to the following definition.

g1 crosses g2 if the interior of g2 has points in common with the interior of g1, but g2 does not cover the entire interior of g1.

But MySQL GIS returns 1, which seems an issue.

Besides, if we shrink the coordinate to 1/10 of the previous one, MySQL GIS gives the right answer:

SET @g1 = ST_GeomFromText('MULTILINESTRING((28 99,2 10))');
SET @g2 = ST_GeomFromText('GEOMETRYCOLLECTION(MULTILINESTRING((28 99,2 10)),POLYGON((6 36,62 85,42 85,6 36)))');

SELECT ST_Crosses(@g1, @g2);
-- result{0}
SELECT ST_Crosses(ST_SwapXY(@g1), ST_SwapXY(@g2));
-- result{0}

Version: 8.2.0 the latest version in Github: 87307d4ddd88405117e3f1e51323836d57ab1f57