Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

After swapping the X and Y coordinates, ST_Crosses gives the incorrect answer. #23

Open
cuteDen-ECNU opened this issue Nov 22, 2023 · 1 comment
Labels
bug-confirm mysql GIS sytax trans Add point to the boundary of geometry

Comments

@cuteDen-ECNU
Copy link
Owner

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

@cuteDen-ECNU cuteDen-ECNU changed the title After swapping the X and Y coordinates, MySQL GIS gives the incorrect answer. After swapping the X and Y coordinates, ST_Crosses gives the incorrect answer. Nov 22, 2023
@cuteDen-ECNU cuteDen-ECNU added sytax trans Add point to the boundary of geometry bug-confirm mysql GIS labels Nov 24, 2023
@cuteDen-ECNU
Copy link
Owner Author

Bugtracker link: https://bugs.mysql.com/bug.php?id=113205

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug-confirm mysql GIS sytax trans Add point to the boundary of geometry
Projects
None yet
Development

No branches or pull requests

1 participant