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

Prepared Contains mismatch with Contains #32

Open
cuteDen-ECNU opened this issue Nov 30, 2023 · 1 comment
Open

Prepared Contains mismatch with Contains #32

cuteDen-ECNU opened this issue Nov 30, 2023 · 1 comment
Labels
fixed libgeos sytax trans Add point to the boundary of geometry

Comments

@cuteDen-ECNU
Copy link
Owner

cuteDen-ECNU commented Nov 30, 2023

Consider the following statements:

DROP table t;
CREATE table t (id int, geom geometry);
INSERT INTO t (id, geom) VALUES (1,ST_GeomFromText('GEOMETRYCOLLECTION(MULTIPOINT((-60 -50),(-63 -49)))'));
INSERT INTO t (id, geom) VALUES (2,ST_GeomFromText('GEOMETRYCOLLECTION(MULTIPOINT((-60 -50),(-63 -49)))'));
INSERT INTO t (id, geom) VALUES (3,ST_GeomFromText('MULTIPOLYGON(((-60 -50,-70 -50,-60 -40,-60 -50)))'));
SELECT a1.id, a2.id FROM t As a1, t As a2 WHERE ST_Contains(a1.geom, a2.geom) and a1.id <> a2.id;
-- actual{1,2; 2,1; 3,1 }
-- expected{1,2; 2,1; 3,1; 3,2 }

It is noticed that the first geometry and the second geometry are equal, which means if the third geometry contains the first one, the third one contains the second as well.

However, when querying the Contains pairs, besides reporting that the first and second geometries contain each other (1,2; 2,1), PostGIS just answers that the third geometry contains the first geometry (3,1), instead of both the first and the second geometries (3,1;3,2), which seems a bug.

The version is the newest on GitHub:

POSTGIS="3.5.0dev 3.4.0rc1-818-g6c2e935b6" [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"
@cuteDen-ECNU cuteDen-ECNU added PostGIS sytax trans Add point to the boundary of geometry labels Dec 1, 2023
@cuteDen-ECNU cuteDen-ECNU changed the title ST_Contains doesn't give one of the pairs with contain relationship. ST_Contains missed one of the pairs. Dec 2, 2023
@cuteDen-ECNU
Copy link
Owner Author

cuteDen-ECNU commented Dec 4, 2023

bugtracker link: https://trac.osgeo.org/postgis/ticket/5634
fix link: 136e8e4
reproduce: b3d6d20

@cuteDen-ECNU cuteDen-ECNU changed the title ST_Contains missed one of the pairs. Prepared Contains mismatch with Contains Jan 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fixed libgeos sytax trans Add point to the boundary of geometry
Projects
None yet
Development

No branches or pull requests

1 participant