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

ST_Crosses returns incorrect answer when dealing with geometry collection #39

Open
cuteDen-ECNU opened this issue Jan 1, 2024 · 1 comment
Labels
bug-confirm libgeos sytax trans Add point to the boundary of geometry

Comments

@cuteDen-ECNU
Copy link
Owner

cuteDen-ECNU commented Jan 1, 2024

Consider the following statement:

SELECT ST_Crosses(g1, g2), ST_Crosses(g1, g3)
FROM (SELECT 
ST_GeomFromText('GEOMETRYCOLLECTION (POINT (7 1), LINESTRING (6 5, 6 4))') As g1,
ST_GeomFromText('POLYGON ((7 1, 1 3, 3 9, 7 1))') As g2,
ST_GeomFromText('POLYGON ((1 3, 3 9, 7 1, 1 3))') As g3
) As sub;
-- actual {true, false}; expected {false, false}

It is noticed that g2 and g3 present the same polygon with different order, while ST_Crosses(g1, g2) and ST_Crosses(g1, g3) give different results, which seems like a bug.

The result of ST_Crosses(g1, g2) is expected to be false because there is no interior intersection, according to the definition:

ST_Crosses(A, B) ⇔ (dim( Int(A) ⋂ Int(B) ) < max( dim( Int(A) ), dim( Int(B) ) )) ∧ (A ⋂ B ≠ A) ∧ (A ⋂ B ≠ B)

It can be reproduced by:

bin/geosop -a "GEOMETRYCOLLECTION (POINT (7 1), LINESTRING (6 5, 6 4))" -b "POLYGON ((7 1, 1 3,  3 9,  7 1))" crosses
# actual{true}; expected{false}

Version is the latest in github:

 POSTGIS="3.5.0dev 3.4.0rc1-839-g61bc019eb" [EXTENSION] PGSQL="170" GEOS="3.13.0dev-CAPI-1.18.0" PROJ="8.2.1 NETWORK_ENABLED=OFF URL_
ENDPOINT=https://cdn.proj.org USER_WRITABLE_DIRECTORY=/tmp/proj DATABASE_PATH=/usr/share/proj/proj.db" LIBXML="2.9.13" (core procs fr
om "3.5.0dev 3.4.0rc1-750-g89fb96385" need upgrade)
@cuteDen-ECNU cuteDen-ECNU added sytax trans Add point to the boundary of geometry libgeos labels Jan 1, 2024
@cuteDen-ECNU
Copy link
Owner Author

bugtracker link: libgeos/geos#1022

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

No branches or pull requests

1 participant